﻿#------------------------------------------------------------------------
# Source File Information (DO NOT MODIFY)
# Source ID: d007dc8d-c0cf-4919-ba55-ea32ee246824
# Source File: UAMT.pfproj
#------------------------------------------------------------------------
#region Project Recovery Data (DO NOT MODIFY)
<#RecoveryData:
aAgAAB+LCAAAAAAABACVVt9v2jAQfp+0/wFFe6UBRrdWCpFYWBEPrIjQPVWqjHMBr4kdnZ12/Pdz
yA+SOEyNeMl99913pzv7jLMFKt4ATwuiiPv502DgbFD8AarOhjZ/A0omuDt27PKz8DywCFYLNxiN
vgf0LhjSEQ2H0/vx/XBPbm+HQL5OACbTb3eTqWMX5CLUFylS8ARXKKICbMNlHdYX26fIEiXt1W69
sxy7k3ZV5I0FgK4vQvVOEJ7XjKKQ2nrOiT4JwZTMg4pq7a5yyz7tTgm4I8eum7UGyUthmTnYQggI
nMIvEsPMsgY/UhYFM2tkub4iqNLkJgll3q//h3okioZrwviDwPglCcO6VolrsfDDYstI7En0kshx
TWrgiTgmPPj5VwHPxj+zdpiC5eZseaPpH86wYfzQLjXDepXpA0F6bMvkaE8hmiJTpyWKNFlDvNfn
25Q1OX2T5LEMUWCHfM3bS/hJAp5jF6AIi4zK2/5+4vM1SEkOejbzIED9DWaCDk7PJDquCDXFL75e
oo9PG0Zfweh0iRtiuZHf0+oaF6uQ0FdyuCyCJXBAUltYBSFLfwHtTrQAV7RaoDVqE10TzkKQykMg
qti9BlaxvVQqEZf+mvY1xyYiKtS7wR1q3cqo3NuU+7t5ttKKr0ugeAf0jxBF5Usw0QIGWLa12S2n
vEkDu/20NIZavTc3o+yXT8dg6jEFKVUGuYW3+e1BdaELkOfnphFvd6J6NSaEn+o9byOeSE7IDsfG
YExsxRUgJ1GrwG74UQczjWadaQVcd2VrHHizjDrSfN6rk5mffTOlvvw7fZUSfV06s+rTU/9n8Q/K
+amNaAgAAA==#>
#endregion
#========================================================================
# Code Generated By: SAPIEN Technologies, Inc., PowerShell Studio 2012 v3.1.27
# Generated On: 12/9/2013 9:35 PM
# Generated By: jheaton
#========================================================================


#region Source: Startup.pfs
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
CwcAAB+LCAAAAAAABAC9Vdtu2zAMfR+wf/AHZJY9x0kLqAYCBx2KYVtQF9teFYVOhcqSoUsD//2U
zNfY6YY+BH4xDy+HokQSPwKVr6CqNTEk+fjB8/APxfZMEH7POHwnBSSZIcrY0i9zjdFIe/I5Sj9B
aSZFEvqfMeoDJ4uV1lBsOQN9kjukSrJKGyj8b0SQPRQgjL+yRhbEOOeZV0e5i/zg+M281HJjFdwJ
sEYRPvM21sWlX6F6ki/gDMNtHt3EC7KLFnOIYoxapmnmjmP+vxzb5ZLENF6Et9Ecgpvbf3L4v5jY
yYP276Uq9FUY14ocmNi/hyuI8jhf5mG4iwMSkTe4Ck2l4mx7nRO5N3oVot8Fv86BmAJqpKoyUK+M
wrsextuX1YpN5+ENoS+u0VST1BcQ4ALXYmfQdvcJRJNoDT7Qus0HpkPUtTfLQZtUwamzkxCjEdZa
p1a7EdDoe7EvKTacmNz1VvLJxW2FVv1oRfa0SgKM6r/OUR5AZc/AeTOv3Pgag3Wx0LBaOANqFTOV
hxpk6HA2G7tzTKIbJXeWmrH1JUWNn1/VFLoGTRUrh2VGk2gqi5KIql/1cySVZeU2wfPgasbYgzCg
3LY4S3Aanlwtfx0uq1xmx5UxzLWHYDRYQ6j3+t1b6C+/P5RBcLgLBwAA#>
#endregion
#----------------------------------------------
#region Import Assemblies
#----------------------------------------------
[void][Reflection.Assembly]::Load("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][Reflection.Assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][Reflection.Assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
[void][Reflection.Assembly]::Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][Reflection.Assembly]::Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][Reflection.Assembly]::Load("System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][Reflection.Assembly]::Load("System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
#endregion Import Assemblies

#Define a Param block to use custom parameters in the project
#Param ($CustomParameter)

function Main {
	Param ([String]$Commandline)
	#Note: This function starts the application
	#Note: $Commandline contains the complete argument string passed to the packager
	#Note: To get the script directory in the Packager use: Split-Path $hostinvocation.MyCommand.path
	#Note: To get the console output in the Packager (Windows Mode) use: $ConsoleOutput (Type: System.Collections.ArrayList)
	#TODO: Initialize and add Function calls to forms
	[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null
	$Global:c = Get-Credential
	ITMTCreate-RemoteSession -AD
	$Global:objUser = $(try {Invoke-Command -Session $global:sAD -ScriptBlock {Get-ADUser -Identity $args[0] -properties memberof} -ArgumentList @($Global:c.UserName) -ea 'Stop'} catch {exit})
	if((Call-MainForm_pff) -eq "OK")
	{
		
	}
	
	ITMTRemove-RemoteSession -AD -Exchange -Lync
	
	$global:ExitCode = 0 #Set the exit code for the Packager
}

#endregion Source: Startup.pfs

#region Source: MainForm.pff
function Call-MainForm_pff
{
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
Iy0BAB+LCAAAAAAABADlXVtv4ziyfj/A+Q9EnnpwMonlewbdARw76c6sc9k43T27LwNZphNtZMmQ
5Fz21x+SkmxZEiUWJUuWG7uYmci6fKz6WCwWi8XPD1izXrH9MVJd9fx//wehz3e2/qSbqnGlG/hW
XeDzG1U3ryx7cbKczz+fxn5mD9G/fmDb0S3zXDlpfj4NX/BeO/0P1lzkfizxl6PJh+PixclP3ZxZ
b84Jfbv3z2OU9NMx8l/1pX3SoP87RsOV4a5s/MXEK9dWjWN0v5oauvYP/PFovWDzy7TXUztap6uc
tdq40T87Qi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/Jx7jf+RjXVJ7zApntCrc2CGZCNEFqiQmgp03mr3+mqs1a3jWn51vWXkr9c
gKAzv1G4arO/OLLVN7YHBv6tRmvemffmijLrNNSWmvKtAvfXCLRIddVSPvTXwiinQbpNOohlfwTp
F7tVVvBV7OhPZvGfWv8ZdPLP96r2Qvq0HSD5ik1MXryJ0Po3UNN7fqPqJu0dxIyErkZvpRnhoQhv
4lViSfQ5dlxWVIK08Jz4irFr67uHK4dYm+D30Lt5P9wbqjsnQOlr1/+9/vVhZU4eB+fEH/T/a/Oc
9YbtyTM2DF/y59TDjF0M4tXbwvo8wdrK1onZDQLcn7cfIBdoMltwUfGU+vk0fHEDxbZmK82N3Ry5
Hr1/WyOniVcJuzTiaW/L+DTxKjsKy/wIizx6ZWgtP2z96XlLL/Fr13TzuakaEYDJl+/Iwzq5SiUT
eYD/E0G2CG9EZ1hDVz6fhoW2JialPmEC1qxXbH9QA3b+//BevVQjLQEA#>
#endregion
	#----------------------------------------------
	#region Import the Assemblies
	#----------------------------------------------
	[void][reflection.assembly]::Load("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	#endregion Import Assemblies

	#----------------------------------------------
	#region Generated Form Objects
	#----------------------------------------------
	[System.Windows.Forms.Application]::EnableVisualStyles()
	$MainForm = New-Object 'System.Windows.Forms.Form'
	$menu = New-Object 'System.Windows.Forms.MenuStrip'
	$TCAdmin = New-Object 'System.Windows.Forms.TabControl'
	$UserAdministration = New-Object 'System.Windows.Forms.TabPage'
	$groupBox13 = New-Object 'System.Windows.Forms.GroupBox'
	$UALyncLnklblDelete = New-Object 'System.Windows.Forms.LinkLabel'
	$UALyncTxtbxSipAddress = New-Object 'System.Windows.Forms.TextBox'
	$UALyncLblSIPAddress = New-Object 'System.Windows.Forms.Label'
	$UALyncCmbbxUserPool = New-Object 'System.Windows.Forms.ComboBox'
	$UALyncLblUserPool = New-Object 'System.Windows.Forms.Label'
	$UALyncCmbbxConfPolicy = New-Object 'System.Windows.Forms.ComboBox'
	$UALyncLblConferencingPolicy = New-Object 'System.Windows.Forms.Label'
	$UALyncCmbbxEAP = New-Object 'System.Windows.Forms.ComboBox'
	$UALyncLblExternalAccessPolicy = New-Object 'System.Windows.Forms.Label'
	$UALyncbtnCreateLyncAccount = New-Object 'System.Windows.Forms.Button'
	$UAADbtnLookup = New-Object 'System.Windows.Forms.Button'
	$groupBox7 = New-Object 'System.Windows.Forms.GroupBox'
	$UAADlnklblOU = New-Object 'System.Windows.Forms.LinkLabel'
	$UAADtxtbxOU = New-Object 'System.Windows.Forms.TextBox'
	$UAbtnClear = New-Object 'System.Windows.Forms.Button'
	$UAADtxtbxDisplayName = New-Object 'System.Windows.Forms.TextBox'
	$label13 = New-Object 'System.Windows.Forms.Label'
	$UAADtxtbxTitle = New-Object 'System.Windows.Forms.TextBox'
	$UAADlvLogonto = New-Object 'System.Windows.Forms.ListView'
	$UAADlvSecGroups = New-Object 'System.Windows.Forms.ListView'
	$UAbtnExecute = New-Object 'System.Windows.Forms.Button'
	$groupbox1 = New-Object 'System.Windows.Forms.GroupBox'
	$UAADcldrAccountExpires = New-Object 'System.Windows.Forms.DateTimePicker'
	$UAADrbEndOf = New-Object 'System.Windows.Forms.RadioButton'
	$UAADrbNever = New-Object 'System.Windows.Forms.RadioButton'
	$groupbox2 = New-Object 'System.Windows.Forms.GroupBox'
	$UAADchkbxAccountDisabled = New-Object 'System.Windows.Forms.CheckBox'
	$UAADchkbxPassNeverExpires = New-Object 'System.Windows.Forms.CheckBox'
	$UAADchkbxCannotChangePass = New-Object 'System.Windows.Forms.CheckBox'
	$UAADchkbxChangePassNextLogon = New-Object 'System.Windows.Forms.CheckBox'
	$groupbox3 = New-Object 'System.Windows.Forms.GroupBox'
	$UAADtxtbxLocalPath = New-Object 'System.Windows.Forms.TextBox'
	$UAADcmbbxDriveLetter = New-Object 'System.Windows.Forms.ComboBox'
	$UAADrbConnect = New-Object 'System.Windows.Forms.RadioButton'
	$UAADrbLocalPath = New-Object 'System.Windows.Forms.RadioButton'
	$UAADtxtbxHomePath = New-Object 'System.Windows.Forms.TextBox'
	$labelTo = New-Object 'System.Windows.Forms.Label'
	$groupbox4 = New-Object 'System.Windows.Forms.GroupBox'
	$labelProfilePath = New-Object 'System.Windows.Forms.Label'
	$UAADtxtbxLogonScript = New-Object 'System.Windows.Forms.TextBox'
	$UAADtxtbxProfilePath = New-Object 'System.Windows.Forms.TextBox'
	$labelLogonScript = New-Object 'System.Windows.Forms.Label'
	$labelInitial = New-Object 'System.Windows.Forms.Label'
	$UAADlblGroups = New-Object 'System.Windows.Forms.Label'
	$UAADtxtbxInitial = New-Object 'System.Windows.Forms.TextBox'
	$UAADtxtbxPhone = New-Object 'System.Windows.Forms.TextBox'
	$labelTelephoneNumber = New-Object 'System.Windows.Forms.Label'
	$UAADtxtbxOffice = New-Object 'System.Windows.Forms.TextBox'
	$labelOffice = New-Object 'System.Windows.Forms.Label'
	$UAADtxtbxDesc = New-Object 'System.Windows.Forms.TextBox'
	$labelDescription = New-Object 'System.Windows.Forms.Label'
	$UAADcmbbxCompany = New-Object 'System.Windows.Forms.ComboBox'
	$UAADtxtbxLN = New-Object 'System.Windows.Forms.TextBox'
	$UAbtnSearch = New-Object 'System.Windows.Forms.Button'
	$label21 = New-Object 'System.Windows.Forms.Label'
	$labelLastName = New-Object 'System.Windows.Forms.Label'
	$labelFirstName = New-Object 'System.Windows.Forms.Label'
	$UAADtxtbxEmpNo = New-Object 'System.Windows.Forms.TextBox'
	$UAADtxtbxFN = New-Object 'System.Windows.Forms.TextBox'
	$labelCompany = New-Object 'System.Windows.Forms.Label'
	$labelJobTitle = New-Object 'System.Windows.Forms.Label'
	$labelLogOnTo = New-Object 'System.Windows.Forms.Label'
	$UAADlnklblEditLogOnTo = New-Object 'System.Windows.Forms.LinkLabel'
	$UAADLnklblSecMirror = New-Object 'System.Windows.Forms.LinkLabel'
	$UAADLnklblSecRemove = New-Object 'System.Windows.Forms.LinkLabel'
	$UAADLnklblSecAdd = New-Object 'System.Windows.Forms.LinkLabel'
	$groupBox12 = New-Object 'System.Windows.Forms.GroupBox'
	$UAExchLnklblDelete = New-Object 'System.Windows.Forms.LinkLabel'
	$UAExchLvMessagingAddresses = New-Object 'System.Windows.Forms.ListView'
	$UAExchLnklblAdd = New-Object 'System.Windows.Forms.LinkLabel'
	$UAExchGbStorageQuotas = New-Object 'System.Windows.Forms.GroupBox'
	$UAExchTxtbxMBProhibit = New-Object 'System.Windows.Forms.TextBox'
	$UAExchTxtbxMBWarning = New-Object 'System.Windows.Forms.TextBox'
	$UAExchChkbxUseMBDefaults = New-Object 'System.Windows.Forms.CheckBox'
	$UAExchChkbxMBProhibit = New-Object 'System.Windows.Forms.CheckBox'
	$UAExchChkbxMBWarning = New-Object 'System.Windows.Forms.CheckBox'
	$UAExchTxtbxAlias = New-Object 'System.Windows.Forms.TextBox'
	$UAExchLblAlias = New-Object 'System.Windows.Forms.Label'
	$UAExchTxtbxDN = New-Object 'System.Windows.Forms.TextBox'
	$UAExchLblDisplayName = New-Object 'System.Windows.Forms.Label'
	$UAExchChkbxHideAddressBook = New-Object 'System.Windows.Forms.CheckBox'
	$UAExchLblMessagingAddresses = New-Object 'System.Windows.Forms.Label'
	$UAExchCmbbxDatabase = New-Object 'System.Windows.Forms.ComboBox'
	$UAExchlblDataBase = New-Object 'System.Windows.Forms.Label'
	$UAExchBtnCreateExchangeAccount = New-Object 'System.Windows.Forms.Button'
	$UAExchLnklblMakePrimary = New-Object 'System.Windows.Forms.LinkLabel'
	$UAExchLnklblRemove = New-Object 'System.Windows.Forms.LinkLabel'
	$UAlblADStatus = New-Object 'System.Windows.Forms.Label'
	$UAADCmbbxStatus = New-Object 'System.Windows.Forms.ComboBox'
	$menuFile = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$helpToolStripMenuItem = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$notifyIcon1 = New-Object 'System.Windows.Forms.NotifyIcon'
	$aboutToolStripMenuItem = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$menuFileExit = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$menuView = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$menuFileConnect = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$menuViewEventVwr = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$menuViewServices = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$menuViewUser = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$menuViewWSUS = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$menuViewWSUSReport = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$menuViewWSUSUpdate = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$contextMenuCI = New-Object 'System.Windows.Forms.ContextMenuStrip'
	$cmsSelect = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$cmsStartupRemove = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$cmsAdminAdd = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$cmsAdminRemove = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$cmsAppUninstall = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$cmsProcEnd = New-Object 'System.Windows.Forms.ToolStripMenuItem'
	$tooltip1 = New-Object 'System.Windows.Forms.ToolTip'
	$miniToolStrip = New-Object 'System.Windows.Forms.StatusStrip'
	$labelEmpNoSAM = New-Object 'System.Windows.Forms.Label'
	$GroupName = New-Object 'System.Windows.Forms.ColumnHeader'
	$ComputerName = New-Object 'System.Windows.Forms.ColumnHeader'
	$EmailAddresses = New-Object 'System.Windows.Forms.ColumnHeader'
	$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
	#endregion Generated Form Objects

	#----------------------------------------------
	# User Generated Script
	#----------------------------------------------
	#region Security Verification
	$u = $global:objUser.memberof
	Switch -wildcard ($u){
		'*ITMT Systems Engineering*' {$Global:Permissions = $Global:Permissions -bor 4}
		'*ITMT Field Services*' {$Global:Permissions = ($Global:Permissions -bor 2)}
		'*ITMT Help Desk*' {$Global:Permissions = ($Global:Permissions -bor 1)}
	}
	if([int]$Global:Permissions -eq 0){
		[System.Windows.Forms.MessageBox]::Show("You are unauthorized to execute this application. This illegal access attempt has been logged.","Access Denied",[System.Windows.Forms.MessageBoxButtons]::OK,[System.Windows.Forms.MessageBoxIcon]::Stop)
		$MainForm.Close()
	}
	#endregion Security Verification
	#region XML
	$xmlComputerInfo = @"
<?xml version="1.0" standalone="no"?>

<OPTIONS Product="Core taken from Arposh Windows System Administration tool with modifications by Jerris Heaton" Version="2.0.1" Author="Rich Prescott, Jerris Heaton">

 <Elevate Enabled="False" Comment="Allows script to be run with admin privileges"/>
 <Domain Default="LDAP://DC=RU,DC=lab" Enabled="False"/>
 <Search Comment="Properties to show when searching for computers. Property names are from ADSI Attribute Editor.">
  <Property>DNSHostName</Property>
  <Property>OperatingSystem</Property>
  <Property>OperatingSystemVersion</Property>
  <Property>WhenChanged</Property>
 </Search>
 <SystemInfo Comment="Information returned when querying System Info">
  <General Enabled="True">
   <ComputerName Enabled="True"/>
   <DomainLocation Enabled="True"/>
   <CurrentUser Enabled="True"/>
   <LogonTime Enabled="True"/>
   <ScreensaverTime Enabled="True"/>
   <LastRestart Enabled="True"/>
  </General>
  <Build Enabled="True">
   <Manufacturer Enabled="True"/>
   <Model Enabled="True"/>
   <Chassis Enabled="True"/>
   <Serial Enabled="True"/>
  </Build>
  <Hardware Enabled="True">
   <CPU Enabled="True"/>
   <RAM Enabled="True"/>
   <HD Enabled="True"/>
   <OpticalDrive Enabled="True"/>
   <GPU Enabled="True"/>
   <Monitor Enabled="True"/>
  </Hardware>
  <OS Enabled="True">
   <OS Enabled="True"/>
   <ServicePack Enabled="True"/>
   <Architecture Enabled="True"/>
   <ImageDate Enabled="True"/>
  </OS>
  <IPConfig Enabled="True">
   <Description Enabled="True"/>
   <IPAddress Enabled="True"/>
   <MACAddress Enabled="True"/>
   <DHCPEnabled Enabled="False"/>
   <DHCPServer Enabled="False"/>
   <DNSDomain Enabled="False"/>
  </IPConfig>
 </SystemInfo>
 <SecurityGroups>
  <Property>Name</Property>
  <Property>Type</Property>
 </SecurityGroups>
 <LocalAdmins>
  <Property>Name</Property>
  <Property>Domain</Property>
  <Property>Class</Property>
 </LocalAdmins>
 <Applications>
  <Property>Name</Property>
  <Property>Vendor</Property>
  <Property>Version</Property>
  <Property>InstallDate</Property>
 </Applications>
 <StartupItems Comment="Unavailable on Windows XP">
  <Property>Location</Property>
  <Property>User</Property>
  <Property>Caption</Property>
  <Property>Command</Property>  
 </StartupItems>
 <Processes>
  <Property>ProcessID</Property>
  <Property>Name</Property>
  <Property>ExecutablePath</Property>
 </Processes>
 <Services>
  <Property>Name</Property>
  <Property>DisplayName</Property>
  <Property>State</Property>
  <Property>StartMode</Property>
 </Services>
 <Websites>
  <Website Name="Engineering Efficiency" URL="http://blog.richprescott.com"/>
  <Website Name="@Rich_Prescott on Twitter" URL="http://www.twitter.com/Rich_Prescott"/>
 </Websites>
</OPTIONS>
"@
	#endregion XML
	#region Header
	#################
	### MAIN FORM ###
	#################
	$OnLoadFormEvent={
	#TODO: Initialize Form Controls here
		$menuFileConnect.Visible = $false
		$menuViewEventVwr.Visible = $false
		$menuViewServices.Visible = $false
		$menuViewUser.Visible = $false
		$menuViewWSUS.Visible = $false
		$menuViewWSUSReport.Visible = $false
		$menuViewWSUSUpdate.Visible = $false
		$MainForm.Activate()
	
	}
	ITMTCreate-RemoteSession -Exchange -Lync	
	#$MainForm.Activate()
	$VBMsg = New-Object -COMObject WScript.Shell
	[XML]$Script:XML = $xmlComputerInfo
	if($XML.Options.Domain.Enabled -eq $true){$Domain = $XML.Options.Domain.Default}
	elseif("\\$env:computername" -eq $env:logonserver){$Domain = "Local"}
	else{$Domain = ([DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()).Name}
	#endregion Header
	#region Control Helper Functions
	function Get-CheckedNodes{
	<#
		.SYNOPSIS
			This function collects a list of checked nodes in a TreeView
	
		.DESCRIPTION
			This function collects a list of checked nodes in a TreeView
	
		.PARAMETER  $NodeCollection
			The collection of nodes to search
	
		.PARAMETER  $CheckedNodes
			The ArrayList that will contain the all the checked items
		
		.EXAMPLE
			$CheckedNodes = New-Object System.Collections.ArrayList
			Get-CheckedNodes $treeview1.Nodes $CheckedNodes
			foreach($node in $CheckedNodes)
			{	
				Write-Host $node.Text
			}
	#>
		param(
		[ValidateNotNull()]
		[System.Windows.Forms.TreeNodeCollection] $NodeCollection,
		[ValidateNotNull()]
		[System.Collections.ArrayList]$CheckedNodes)
		
		foreach($Node in $NodeCollection)
		{
			if($Node.Checked)
			{
				[void]$CheckedNodes.Add($Node)
			}
			Get-CheckedNodes $Node.Nodes $CheckedNodes
		}
	}
	function Sort-ListViewColumn{
		<#
		.SYNOPSIS
			Sort the ListView's item using the specified column.
	
		.DESCRIPTION
			Sort the ListView's item using the specified column.
			This function uses Add-Type to define a class that sort the items.
			The ListView's Tag property is used to keep track of the sorting.
	
		.PARAMETER ListView
			The ListView control to sort.
	
		.PARAMETER ColumnIndex
			The index of the column to use for sorting.
			
		.PARAMETER  SortOrder
			The direction to sort the items. If not specified or set to None, it will toggle.
		
		.EXAMPLE
			Sort-ListViewColumn -ListView $listview1 -ColumnIndex 0
	#>
		param(	
				[ValidateNotNull()]
				[Parameter(Mandatory=$true)]
				[System.Windows.Forms.ListView]$ListView,
				[Parameter(Mandatory=$true)]
				[int]$ColumnIndex,
				[System.Windows.Forms.SortOrder]$SortOrder = 'None')
		
		if(($ListView.Items.Count -eq 0) -or ($ColumnIndex -lt 0) -or ($ColumnIndex -ge $ListView.Columns.Count))
		{
			return;
		}
		
		#region Define ListViewItemComparer
			try{
			$local:type = [ListViewItemComparer]
		}
		catch{
		Add-Type -ReferencedAssemblies ('System.Windows.Forms') -TypeDefinition  @" 
using System;
using System.Windows.Forms;
using System.Collections;
public class ListViewItemComparer : IComparer
{
    public int column;
    public SortOrder sortOrder;
    public ListViewItemComparer()
    {
        column = 0;
		sortOrder = SortOrder.Ascending;
    }
    public ListViewItemComparer(int column, SortOrder sort)
    {
        this.column = column;
		sortOrder = sort;
    }
    public int Compare(object x, object y)
    {
		if(column >= ((ListViewItem)x).SubItems.Count)
			return  sortOrder == SortOrder.Ascending ? -1 : 1;
	
		if(column >= ((ListViewItem)y).SubItems.Count)
			return sortOrder == SortOrder.Ascending ? 1 : -1;
	
		if(sortOrder == SortOrder.Ascending)
        	return String.Compare(((ListViewItem)x).SubItems[column].Text, ((ListViewItem)y).SubItems[column].Text);
		else
			return String.Compare(((ListViewItem)y).SubItems[column].Text, ((ListViewItem)x).SubItems[column].Text);
    }
}
"@  | Out-Null
		}
		#endregion
		
		if($ListView.Tag -is [ListViewItemComparer])
		{
			#Toggle the Sort Order
			if($SortOrder -eq [System.Windows.Forms.SortOrder]::None)
			{
				if($ListView.Tag.column -eq $ColumnIndex -and $ListView.Tag.sortOrder -eq 'Ascending')
				{
					$ListView.Tag.sortOrder = 'Descending'
				}
				else
				{
					$ListView.Tag.sortOrder = 'Ascending'
				}
			}
			else
			{
				$ListView.Tag.sortOrder = $SortOrder
			}
			
			$ListView.Tag.column = $ColumnIndex
			$ListView.Sort()#Sort the items
		}
		else
		{
			if($Sort -eq [System.Windows.Forms.SortOrder]::None)
			{
				$Sort = [System.Windows.Forms.SortOrder]::Ascending	
			}
			
			#Set to Tag because for some reason in PowerShell ListViewItemSorter prop returns null
			$ListView.Tag = New-Object ListViewItemComparer ($ColumnIndex, $SortOrder) 
			$ListView.ListViewItemSorter = $ListView.Tag #Automatically sorts
		}
	}
	function Add-ListViewItem{
	<#
		.SYNOPSIS
			Adds the item(s) to the ListView and stores the object in the ListViewItem's Tag property.
	
		.DESCRIPTION
			Adds the item(s) to the ListView and stores the object in the ListViewItem's Tag property.
	
		.PARAMETER ListView
			The ListView control to add the items to.
	
		.PARAMETER Items
			The object or objects you wish to load into the ListView's Items collection.
			
		.PARAMETER  ImageIndex
			The index of a predefined image in the ListView's ImageList.
		
		.PARAMETER  SubItems
			List of strings to add as Subitems.
		
		.PARAMETER Group
			The group to place the item(s) in.
		
		.PARAMETER Clear
			This switch clears the ListView's Items before adding the new item(s).
		
		.EXAMPLE
			Add-ListViewItem -ListView $listview1 -Items "Test" -Group $listview1.Groups[0] -ImageIndex 0 -SubItems "Installed"
	#>
		
		Param( 
		[ValidateNotNull()]
		[Parameter(Mandatory=$true)]
		[System.Windows.Forms.ListView]$ListView,
		[ValidateNotNull()]
		[Parameter(Mandatory=$true)]
		$Items,
		[int]$ImageIndex = -1,
		[string[]]$SubItems,
		[System.Windows.Forms.ListViewGroup]$Group,
		[switch]$Clear)
		
		if($Clear)
		{
			$ListView.Items.Clear();
		}
		
		if($Items -is [Array])
		{
			$ListView.BeginUpdate()
			foreach ($item in $Items)
			{		
				$listitem  = $ListView.Items.Add($item.ToString(), $ImageIndex)
				#Store the object in the Tag
				$listitem.Tag = $item
				
				if($SubItems -ne $null)
				{
					$listitem.SubItems.AddRange($SubItems)
				}
				
				if($Group -ne $null)
				{
					$listitem.Group = $Group
				}
			}
			$ListView.EndUpdate()
		}
		else
		{
			#Add a new item to the ListView
			$listitem  = $ListView.Items.Add($Items.ToString(), $ImageIndex)
			#Store the object in the Tag
			$listitem.Tag = $Items
			
			if($SubItems -ne $null)
			{
				$listitem.SubItems.AddRange($SubItems)
			}
			
			if($Group -ne $null)
			{
				$listitem.Group = $Group
			}
		}
	}
	function Load-ComboBox{
	<#
		.SYNOPSIS
			This functions helps you load items into a ComboBox.
	
		.DESCRIPTION
			Use this function to dynamically load items into the ComboBox control.
	
		.PARAMETER  ComboBox
			The ComboBox control you want to add items to.
	
		.PARAMETER  Items
			The object or objects you wish to load into the ComboBox's Items collection.
	
		.PARAMETER  DisplayMember
			Indicates the property to display for the items in this control.
		
		.PARAMETER  Append
			Adds the item(s) to the ComboBox without clearing the Items collection.
		
		.EXAMPLE
			Load-ComboBox $combobox1 "Red", "White", "Blue"
		
		.EXAMPLE
			Load-ComboBox $combobox1 "Red" -Append
			Load-ComboBox $combobox1 "White" -Append
			Load-ComboBox $combobox1 "Blue" -Append
		
		.EXAMPLE
			Load-ComboBox $combobox1 (Get-Process) "ProcessName"
	#>
		Param (
			[ValidateNotNull()]
			[Parameter(Mandatory=$true)]
			[System.Windows.Forms.ComboBox]$ComboBox,
			[ValidateNotNull()]
			[Parameter(Mandatory=$true)]
			$Items,
		    [Parameter(Mandatory=$false)]
			[string]$DisplayMember,
			[switch]$Append
		)
		
		if(-not $Append)
		{
			$ComboBox.Items.Clear()	
		}
		
		if($Items -is [Object[]])
		{
			$ComboBox.Items.AddRange($Items)
		}
		elseif ($Items -is [Array])
		{
			$ComboBox.BeginUpdate()
			foreach($obj in $Items)
			{
				$ComboBox.Items.Add($obj)	
			}
			$ComboBox.EndUpdate()
		}
		else
		{
			$ComboBox.Items.Add($Items)	
		}
	
		$ComboBox.DisplayMember = $DisplayMember	
	}
	function Load-ListBox{
	<#
		.SYNOPSIS
			This functions helps you load items into a ListBox or CheckedListBox.
	
		.DESCRIPTION
			Use this function to dynamically load items into the ListBox control.
	
		.PARAMETER  ListBox
			The ListBox control you want to add items to.
	
		.PARAMETER  Items
			The object or objects you wish to load into the ListBox's Items collection.
	
		.PARAMETER  DisplayMember
			Indicates the property to display for the items in this control.
		
		.PARAMETER  Append
			Adds the item(s) to the ListBox without clearing the Items collection.
		
		.EXAMPLE
			Load-ListBox $ListBox1 "Red", "White", "Blue"
		
		.EXAMPLE
			Load-ListBox $listBox1 "Red" -Append
			Load-ListBox $listBox1 "White" -Append
			Load-ListBox $listBox1 "Blue" -Append
		
		.EXAMPLE
			Load-ListBox $listBox1 (Get-Process) "ProcessName"
	#>
		Param (
			[ValidateNotNull()]
			[Parameter(Mandatory=$true)]
			[System.Windows.Forms.ListBox]$ListBox,
			[ValidateNotNull()]
			[Parameter(Mandatory=$true)]
			$Items,
		    [Parameter(Mandatory=$false)]
			[string]$DisplayMember,
			[switch]$Append
		)
		
		if(-not $Append)
		{
			$listBox.Items.Clear()	
		}
		
		if($Items -is [System.Windows.Forms.ListBox+ObjectCollection])
		{
			$listBox.Items.AddRange($Items)
		}
		elseif ($Items -is [Array])
		{
			$listBox.BeginUpdate()
			foreach($obj in $Items)
			{
				$listBox.Items.Add($obj)
			}
			$listBox.EndUpdate()
		}
		else
		{
			$listBox.Items.Add($Items)	
		}
	
		$listBox.DisplayMember = $DisplayMember	
	}
	#endregion
	#REGION UserAdministration
	#region UA Functions
	function UASearchUser{
		Param([string] $samAccountName)	
		$Global:UAuser = $(try {Invoke-Command -Session $global:sAD -ScriptBlock {Get-ADUser -Identity $args[0] -Properties cn,company,department,description,displayName,distinguishedName,employeeID,employeeType,givenName,homeDirectory,homeDrive,lastLogonTimestamp,name,physicalDeliveryOfficeName,sAMAccountName,scriptPath,sn,telephoneNumber,title,userAccountControl,userPrincipalName} -ArgumentList @($samAccountName)} catch {[System.Windows.Forms.MessageBox]::Show($_.Exception.Message);return})
	}
	function HashGenerator{
		$hash = @{}
		### Text Box Fields ###
		$hash.Add("UAADtxtbxEmpNo",$UAADtxtbxEmpNo.Text)
		$hash.Add("UAADtxtbxFN",$UAADtxtbxFN.Text)
		$hash.Add("UAADtxtbxInitial",$UAADtxtbxInitial.Text)
		$hash.Add("UAADtxtbxLN",$UAADtxtbxLN.Text)
		$hash.Add("UAADtxtbxDisplayName",$UAADtxtbxDisplayName.Text)
		$hash.Add("UAADtxtbxDesc",$UAADtxtbxDesc.Text)
		$hash.Add("UAADtxtbxOffice",$UAADtxtbxOffice.Text)
		$hash.Add("UAADtxtbxPhone",$UAADtxtbxPhone.Text)
		$hash.Add("UAADtxtbxTitle",$UAADtxtbxTitle.Text)
		$hash.Add("UAADtxtbxOU",$UAADtxtbxOU.text)	
		$hash.Add("UAADtxtbxProfilePath",$UAADtxtbxProfilePath.Text)
		$hash.Add("UAADtxtbxLogonScript",$UAADtxtbxLogonScript.Text)
		$hash.Add("UAADtxtbxLocalPath",$UAADtxtbxLocalPath.Text)
		$hash.Add("UAADtxtbxHomePath",$UAADtxtbxHomePath.Text)
		$hash.Add("UALyncTxtbxSipAddress",$UALyncTxtbxSipAddress.Text)	
		$hash.Add("UAExchTxtbxDN",$UAExchTxtbxDN.Text)
		$hash.Add("UAExchTxtbxAlias",$UAExchTxtbxAlias.Text)
		$hash.Add("UAExchTxtbxMBWarning",$UAExchTxtbxMBWarning.Text)
		$hash.Add("UAExchTxtbxMBProhibit",$UAExchTxtbxMBProhibit.Text)
		### Check Box Fields ###
		$hash.Add("UAADchkbxChangePassNextLogon",$UAADchkbxChangePassNextLogon.checked)
		$hash.Add("UAADchkbxCannotChangePass",$UAADchkbxCannotChangePass.checked)
		$hash.Add("UAADchkbxPassNeverExpires",$UAADchkbxPassNeverExpires.checked)
		$hash.Add("UAADchkbxAccountDisabled",$UAADchkbxAccountDisabled.checked)
		$hash.Add("UAExchChkbxHideAddressBook",$UAExchChkbxHideAddressBook.checked)
		$hash.Add("UAExchChkbxUseMBDefaults",$UAExchChkbxUseMBDefaults.checked)
		$hash.Add("UAExchChkbxMBWarning",$UAExchChkbxMBWarning.checked)
		$hash.Add("UAExchChkbxMBProhibit",$UAExchChkbxMBProhibit.checked)
		### Radio Button Fields ###
		$hash.Add("UAADrbLocalPath",$UAADrbLocalPath.checked)
		$hash.Add("UAADrbConnect",$UAADrbConnect.checked)
		$hash.Add("UAADrbEndOf",$UAADrbEndOf.checked)
		$hash.Add("UAADrbNever",$UAADrbNever.checked)
		### Combo Box Fields ###
		$hash.Add("UAADcmbbxCompany",$UAADcmbbxCompany.SelectedItem)
		$hash.Add("UAADcmbbxDriveLetter",$UAADcmbbxDriveLetter.SelectedItem)
		$hash.Add("UALyncCmbbxEAP",$UALyncCmbbxEAP.SelectedItem)
		$hash.Add("UALyncCmbbxUserPool",$UALyncCmbbxUserPool.SelectedItem)
		$hash.Add("UALyncCmbbxConfPolicy",$UALyncCmbbxConfPolicy.SelectedItem)
		$hash.Add("UAExchCmbbxDatabase",$UAExchCmbbxDatabase.SelectedItem)
		$hash.Add("UAADCmbbxStatus",$UAADCmbbxStatus.SelectedItem)
		return $hash
	}
	function LVArrayGenerator{
		Param($LV)
		$array = @()
		$count = $LV.Items.Count
		for ($i=0; $i -lt $count; $i++){
			$array += $LV.Items[$i].Text
		}
		return $array
	}
	function Clear-UA{
		$HasExchange = $true
		$UAADcldrAccountExpires.Enabled = $false
		$UAADchkbxAccountDisabled.Checked = $false
		$UAADchkbxCannotChangePass.Checked = $false
		$UAADchkbxChangePassNextLogon.Checked = $false
		$UAADchkbxPassNeverExpires.Checked = $false
		$UAADcmbbxCompany.SelectedIndex = -1
		$UAADcmbbxDriveLetter.SelectedIndex = -1
		$UAADCmbbxStatus.SelectedIndex = -1
		$UAADlvSecGroups.Items.Clear()
		$UAADrbConnect.Checked = $false
		$UAADrbEndOf.Checked = $false
		$UAADrbLocalPath.Checked = $false
		$UAADrbNever.Checked = $false
		$UAADtxtbxDesc.Text = $null
		$UAADtxtbxDisplayName.Text = $null
		$UAADtxtbxEmpNo.Text = $null
		$UAADtxtbxFN.Text = $null
		$UAADtxtbxHomePath.Text = $null
		$UAADtxtbxInitial.Text = $null
		$UAADtxtbxLN.Text = $null
		$UAADtxtbxLocalPath.Text = $null
		$UAADtxtbxLogonScript.Text = $null
		$UAADtxtbxOffice.Text = $null
		$UAADtxtbxPhone.Text = $null
		$UAADtxtbxProfilePath.Text = $null
		$UAADtxtbxTitle.Text = $null
		$UAADtxtbxOU.Text = $null	
		$UAExchChkbxHideAddressBook.Checked = $false
		$UAExchChkbxMBProhibit.Checked = $false
		$UAExchChkbxMBWarning.Checked = $false
		$UAExchCmbbxDatabase.SelectedIndex = -1
		$UAExchLvMessagingAddresses.Items.Clear()
		$UAExchTxtbxAlias.Text = $null
		$UAExchTxtbxDN.Text = $null
		$UAExchTxtbxMBProhibit.Text = $null
		$UAExchTxtbxMBWarning.Text = $null
		$UALyncCmbbxConfPolicy.SelectedIndex = -1
		$UALyncCmbbxEAP.SelectedIndex = -1
		$UALyncCmbbxUserPool.SelectedIndex = -1
		$UALyncTxtbxSipAddress.Text = $null
		Show-UAExchangeFields
	}
	function Get-UAData{
		Param(
			[parameter(
				mandatory=$true
			)]
			[string]$samAccountName
		)
		Clear-UA
		$Global:UAuser = $(try {Invoke-Command -Session $Global:sAD -ScriptBlock { Get-ADUser -Identity $args[0] -Property cn,company,department,description,displayName,distinguishedName,employeeID,employeeType,givenName,homeDirectory,homeDrive,lastLogonTimestamp,name,physicalDeliveryOfficeName,sAMAccountName,scriptPath,sn,telephoneNumber,title,userAccountControl,userPrincipalName,LockedOut,memberOf,msRTCSIP-PrimaryUserAddress } -ArgumentList @($samAccountName) -ea 'Stop'} catch {[System.Windows.Forms.MessageBox]::Show($_.Exception.Message);return})
		$UAexchUser = $(try {Invoke-Command -Session $global:sExch -ScriptBlock{Get-Mailbox $args[0]} -ArgumentList @($samAccountName) -ea 'Stop'} catch {$null})
		if($UAexchUser -eq $null){
			Hide-UAExchangeFields			
		}
		else {
			$UAexchStats = $(try {Invoke-Command -Session $global:sExch -ScriptBlock{Get-MailboxStatistics $args[0]} -ArgumentList @($samAccountName) -ea 'Stop'} catch {[System.Windows.Forms.MessageBox]::Show($_.Exception.Message)})
		}
		
		################### Lync Section ###################
		if (($Global:UAuser.'msRTCSIP-PrimaryUserAddress' -eq $null) -or ($Global:UAuser.'msRTCSIP-PrimaryUserAddress' -eq "")){
			Hide-UALyncFields
		}
		else{
			Show-UALyncFields
			$UAlyncUser = Invoke-Command -Session $global:sLync -ScriptBlock{Get-CSUser $args[0]} -ArgumentList @($Global:UAuser.'msRTCSIP-PrimaryUserAddress')
			$UALyncCmbbxConfPolicy.Text = $UAlyncUser.ConferencingPolicy
			$UALyncCmbbxEAP.Text = $UAlyncUser.ExternalAccessPolicy
			$UALyncCmbbxUserPool.Text = $UAlyncUser.RegistrarPool
			$UALyncTxtbxSipAddress.Text = $UAlyncUser.SipAddress
		}
		
		#################### AD Section ####################
		$UAADtxtbxDesc.Text = $global:UAuser.description
		$UAADtxtbxDisplayName.Text = $global:UAuser.displayName
		$UAADtxtbxEmpNo.Text = $global:UAuser.samAccountName
		$UAADtxtbxFN.Text = $global:UAuser.givenName
		if($global:UAuser.homeDrive -or $global:UAuser.homeDirectory){
			$UAADrbConnect.Checked = $true
			$UAADtxtbxHomePath.Text = $global:UAuser.homeDirectory
			$UAADcmbbxDriveLetter.Text = $global:UAuser.homeDrive
		}
		$UAADtxtbxInitial.Text = $global:UAuser.initials
		$UAADtxtbxLN.Text = $global:UAuser.sn
		$UAADtxtbxLocalPath.Text = $null
		$UAADtxtbxLogonScript.Text = $global:UAuser.scriptPath
		$UAADtxtbxOffice.Text = $global:UAuser.PhysicalDeliveryOfficeName
		$UAADtxtbxPhone.Text = $global:UAuser.telephoneNumber
		$UAADtxtbxProfilePath.Text = $global:UAuser.profilePath
		$UAADtxtbxTitle.Text = $global:UAuser.title
		$UAADcmbbxCompany.Text = $global:UAuser.Company
		$global:UAuser.distinguishedName -match '^CN=.+?,(.*)$'
		$UAADtxtbxOU.Text = $matches[1]
		### Check Boxes ###
		if($global:UAuser.PasswordLastSet -eq $null){$UAADchkbxChangePassNextLogon.Checked = $true}
		if($global:UAuser.CannotChangePassword -eq $true){$UAADchkbxCannotChangePass.Checked = $true}
		if($global:UAuser.PasswordNeverExpires -eq $true){$UAADchkbxPassNeverExpires.Checked = $true}
		if($global:UAuser.Enabled -eq $false){$UAADchkbxAccountDisabled.Checked = $true}
		### Account Expiration Date ###
		if($global:UAuser.AccountExpirationdate -eq $null){$UAADrbNever.Checked = $true}
		else{
			$UAADrbEndOf.Checked = $true
			$UAADcldrAccountExpires.Enabled = $true
			$UAADcldrAccountExpires.Text = $global:UAuser.AccountExpirationDate
		}
		### Security Groups ###
		foreach($g in $Global:UAuser.memberOf){
			$g -match '^CN=(.+?),OU=(.+?),.*$'
			Add-ListViewItem -ListView $UAADlvSecGroups -Items $matches[1]
		}
		Sort-ListViewColumn -ListView $UAADlvSecGroups -ColumnIndex 0 -SortOrder 'Ascending'	
		### Logon Workstations ###
		$LW = $global:UAuser.LogonWorkstations
		if ($LW -ne $null){
			$LW -split ',' | %{Add-ListViewItem -ListView $UAADlvLogonto -Items $_}
			Sort-ListViewColumn -ListView $UAADlvLogonto -ColumnIndex 0 -SortOrder 'Ascending'	
		}
		
		################# Exchange Section #################
		$UAExchTxtbxAlias.Text = $UAexchUser.alias
		$UAExchTxtbxDN.Text = $UAexchUser.displayName
		$UAExchCmbbxDatabase.Text = $UAexchUser.Database
		if($UAexchUser.UseDatabaseQuotaDefaults -eq $false){
			if($UAexchUser.IssueWarningQuota -eq "unlimited"){}
			else{
				$UAExchChkbxMBWarning.Checked = $true
				$UAexchUser.IssueWarningQuota -match '^([0-9]+?) MB.*$'
				$UAExchTxtbxMBWarning.Text = $matches[1]
			}
			if($UAexchUser.ProhibitSendQuota -eq "unlimited"){}
			else{
				$UAExchChkbxMBProhibit.Checked = $true
				$UAexchUser.ProhibitSendQuota -match '^([0-9]+?) MB.*$'
				$UAExchTxtbxMBProhibit.Text = $matches[1]
			}
		}
		else{$UAExchChkbxUseMBDefaults.Checked = $true}
		if($global:UAuser.HiddenFromAddressListsEnabled -eq $true){$UAExchChkbxHideAddressBook.Checked = $true}
		$EmailAddresses = $UAexchUser.EmailAddresses
		if ($EmailAddresses -ne $null){
			$EmailAddresses -split ',' | %{Add-ListViewItem -ListView $UAExchLvMessagingAddresses -Items $_}
		}
	}
	function Hide-UAExchangeFields{
		$UAExchChkbxHideAddressBook.Visible = $false
		$UAExchChkbxMBProhibit.Visible = $false
		$UAExchChkbxMBWarning.Visible = $false
		$UAExchChkbxUseMBDefaults.Visible = $false
		$UAExchCmbbxDatabase.Visible = $false
		$UAExchGbStorageQuotas.Visible = $false
		$UAExchLblAlias.Visible = $false
		$UAExchlblDataBase.Visible = $false
		$UAExchLblDisplayName.Visible = $false
		$UAExchLblMessagingAddresses.Visible = $false
		$UAExchLnklblAdd.Visible = $false
		$UAExchLvMessagingAddresses.Visible = $false
		$UAExchTxtbxAlias.Visible = $false
		$UAExchTxtbxDN.Visible = $false
		$UAExchTxtbxMBProhibit.Visible = $false
		$UAExchTxtbxMBWarning.Visible = $false
		$UAExchBtnCreateExchangeAccount.Visible = $true
	}
	function Show-UAExchangeFields{
		$UAExchBtnCreateExchangeAccount.Visible = $false
		$UAExchChkbxHideAddressBook.Visible = $true
		$UAExchChkbxMBProhibit.Visible = $true
		$UAExchChkbxMBWarning.Visible = $true
		$UAExchChkbxUseMBDefaults.Visible = $true
		$UAExchCmbbxDatabase.Visible = $true
		$UAExchGbStorageQuotas.Visible = $true
		$UAExchLblAlias.Visible = $true
		$UAExchlblDataBase.Visible = $true
		$UAExchLblDisplayName.Visible = $true
		$UAExchLblMessagingAddresses.Visible = $true
		$UAExchLnklblAdd.Visible = $true
		$UAExchLvMessagingAddresses.Visible = $true
		$UAExchTxtbxAlias.Visible = $true
		$UAExchTxtbxDN.Visible = $true
		$UAExchTxtbxMBProhibit.Visible = $true
		$UAExchTxtbxMBWarning.Visible = $true
	}
	function Hide-UALyncFields{
		$UALyncCmbbxConfPolicy.Visible = $false
		$UALyncCmbbxEAP.Visible = $false
		$UALyncCmbbxUserPool.Visible = $false
		$UALyncTxtbxSipAddress.Visible = $false
		$UALyncLblConferencingPolicy.Visible = $false
		$UALyncLblExternalAccessPolicy.Visible = $false
		$UALyncLblUserPool.Visible = $false
		$UALyncLblSIPAddress.Visible = $false	
		$UALyncbtnCreateLyncAccount.Visible = $true
	}
	function Show-UALyncFields{
		$UALyncbtnCreateLyncAccount.Visible = $false
		$UALyncCmbbxConfPolicy.Visible = $true
		$UALyncCmbbxEAP.Visible = $true
		$UALyncCmbbxUserPool.Visible = $true
		$UALyncTxtbxSipAddress.Visible = $true
		$UALyncLblConferencingPolicy.Visible = $true
		$UALyncLblExternalAccessPolicy.Visible = $true
		$UALyncLblUserPool.Visible = $true
		$UALyncLblSIPAddress.Visible = $true
	}
	#endregion UA Functions
	#region UA Buttons
	$UAbtnSearch_Click={
		Get-UAData -samAccountName $UAADtxtbxEmpNo.Text
		$Global:UAHash_Ref = HashGenerator
		$Global:UALVMessagingAddresses_Ref = LVArrayGenerator -LV $UAExchLvMessagingAddresses
		#$Global:UA_Original.GetEnumerator() | Sort-Object Name | ogv
	}
	$UAADbtnLookup_Click={
		if((Call-Search_pff) -eq "OK"){
			$UAADtxtbxEmpNo.Text = $Search_SearchResult
			UASearchUser -samAccountName $UAADtxtbxEmpNo.Text		
		}
	}
	$UAbtnClear_Click={
		Clear-UA	
	}
	$UAADLnklblSecRemove_LinkClicked=[System.Windows.Forms.LinkLabelLinkClickedEventHandler]{
	#Event Argument: $_ = [System.Windows.Forms.LinkLabelLinkClickedEventArgs]
		
		foreach($item in $UAADlvSecGroups.SelectedItems){
			$UAADlvSecGroups.Items.Remove($item)
		}
		
	}
	$UAADLnklblSecMirror_LinkClicked=[System.Windows.Forms.LinkLabelLinkClickedEventHandler]{
	#Event Argument: $_ = [System.Windows.Forms.LinkLabelLinkClickedEventArgs]
		if((Call-SecGroupMirror_pff) -eq "OK"){
			
		}
		
	}
	$UAExchLnklblAdd_LinkClicked=[System.Windows.Forms.LinkLabelLinkClickedEventHandler]{
	#Event Argument: $_ = [System.Windows.Forms.LinkLabelLinkClickedEventArgs]
		if((Call-UAAddAddress_pff) -eq "OK"){
			$MessagingAddress = "smtp:" + $UAAddAddress_txtbxEmailAddress
			Add-ListViewItem -ListView $UAExchLvMessagingAddresses -Items $MessagingAddress
		}
		
	}
	$UAExchLnklblRemove_LinkClicked=[System.Windows.Forms.LinkLabelLinkClickedEventHandler]{
	#Event Argument: $_ = [System.Windows.Forms.LinkLabelLinkClickedEventArgs]
		foreach($item in $UAExchLvMessagingAddresses.SelectedItems){
			if($item[0][0].Text -like "sip:*"){[System.Windows.Forms.MessageBox]::Show("You cannot remove a Sip address this way. Please use the Lync section for this function.","Sip Address Detected",[System.Windows.Forms.MessageBoxButtons]::OK,[System.Windows.Forms.MessageBoxIcon]::Warning)}
			else{$UAExchLvMessagingAddresses.Items.Remove($item)}
		}
		
	}
	$UAExchLnklblMakePrimary_LinkClicked=[System.Windows.Forms.LinkLabelLinkClickedEventHandler]{
	#Event Argument: $_ = [System.Windows.Forms.LinkLabelLinkClickedEventArgs]
		if($UAExchLvMessagingAddresses.SelectedItems.Count -gt 1){[System.Windows.Forms.MessageBox]::Show("You cannot make more than one address primary.","Error",[System.Windows.Forms.MessageBoxButtons]::OK,[System.Windows.Forms.MessageBoxIcon]::Error);return}
		foreach($item in $UAExchLvMessagingAddresses.SelectedItems){
			if($item[0][0].Text -cmatch '^(SMTP:).*$'){[System.Windows.Forms.MessageBox]::Show("The selected SMTP address is already the primary.","Already Primary",[System.Windows.Forms.MessageBoxButtons]::OK,[System.Windows.Forms.MessageBoxIcon]::Information)}
			if($item[0][0].Text -notlike "smtp:*"){[System.Windows.Forms.MessageBox]::Show("You cannot make a non-SMTP address primary.","Error",[System.Windows.Forms.MessageBoxButtons]::OK,[System.Windows.Forms.MessageBoxIcon]::Error);return}
			else{$index = $item.Index}
		}
		for ($i=0; $i -lt $UAExchLvMessagingAddresses.Items.Count; $i++){
			$UAExchLvMessagingAddresses.items[$i][0].text = $UAExchLvMessagingAddresses.items[$i][0].text -creplace '^SMTP:(.*)$', 'smtp:$1'
		}
		$UAExchLvMessagingAddresses.items[$index][0].text= $UAExchLvMessagingAddresses.items[$index][0].text -creplace '^smtp:(.*)$', 'SMTP:$1'
	}
	$UAbtnExecute_Click={
		$Global:UAHash_Diff = HashGenerator
		$Global:UALVMessagingAddresses_Diff = LVArrayGenerator -LV $UAExchLvMessagingAddresses
		#$Global:UA_Original.GetEnumerator() | Sort-Object Name | ogv
		#$Global:UA_Modified.GetEnumerator() | Sort-Object Name | ogv
		Compare-Hashtable $global:UAHash_Ref $global:UAHash_Diff | ogv
		Compare-Object -ReferenceObject $Global:UALVMessagingAddresses_Ref -DifferenceObject $Global:UALVMessagingAddresses_Diff | ogv
	}
	#endregion UA Buttons
	#region UA CheckedChanged/LinkClicked
	$UAExchChkbxUseMBDefaults_CheckedChanged={
		if($UAExchChkbxUseMBDefaults.Checked -eq $true){
			$UAExchChkbxMBProhibit.Checked = $false
			$UAExchChkbxMBWarning.Checked = $false
			$UAExchChkbxMBProhibit.Enabled = $false
			$UAExchChkbxMBWarning.Enabled = $false
			#$UAExchTxtbxMBProhibit.Text = $null
			#$UAExchTxtbxMBWarning.Text = $null
			$UAExchTxtbxMBProhibit.Enabled = $false
			$UAExchTxtbxMBWarning.Enabled = $false
		}
		else{
			$UAExchChkbxMBProhibit.Enabled = $true
			$UAExchChkbxMBWarning.Enabled = $true
			$UAExchTxtbxMBProhibit.Enabled = $false
			$UAExchTxtbxMBWarning.Enabled = $false
		}
	}
	$UAExchChkbxMBWarning_CheckedChanged={
		if($UAExchChkbxMBWarning.Checked -eq $true){
			$UAExchTxtbxMBWarning.Enabled = $true	
		}
		else{
			$UAExchTxtbxMBWarning.Enabled = $false
			#$UAExchTxtbxMBWarning.Text = $null
		}
	}
	$UAExchChkbxMBProhibit_CheckedChanged={
		if($UAExchChkbxMBProhibit.Checked -eq $true){
			$UAExchTxtbxMBProhibit.Enabled = $true
		}
		else{
			$UAExchTxtbxMBProhibit.Enabled = $false
			#$UAExchTxtbxMBProhibit.Text = $null
		}	
	}
	$UAADrbLocalPath_CheckedChanged={
		$UAADtxtbxHomePath.Text = $null
		$UAADcmbbxDriveLetter.SelectedIndex = -1
	}
	$UAADrbConnect_CheckedChanged={
		$UAADtxtbxLocalPath.Text = $null
	}
	$UAADrbEndOf_CheckedChanged={
		$UAADcldrAccountExpires.Enabled = $true
		
	}
	$UAADrbNever_CheckedChanged={
		$UAADcldrAccountExpires.Enabled = $false
		
	}
	$UAADchkbxChangePassNextLogon_CheckedChanged={
		if(($UAADchkbxCannotChangePass.Checked -eq $true) -and ($UAADchkbxChangePassNextLogon.Checked -eq $true)){
			[System.Windows.Forms.MessageBox]::Show("You cannot select both 'User must change password at next logon' and 'User cannot change password' for the same user.","Warning",0,"Warning")
			$UAADchkbxCannotChangePass.Checked = $false
		}
		if(($UAADchkbxPassNeverExpires.Checked -eq $true) -and ($UAADchkbxChangePassNextLogon.Checked -eq $true)){
			[System.Windows.Forms.MessageBox]::Show("You have selected 'Password never expires'. The user will not be required to change the password at next logon.","Warning",0,"Warning")		
			$UAADchkbxChangePassNextLogon.Checked = $false
		}	
	}
	$UAADchkbxCannotChangePass_CheckedChanged={
		if(($UAADchkbxCannotChangePass.Checked -eq $true) -and ($UAADchkbxChangePassNextLogon.Checked -eq $true)){
			[System.Windows.Forms.MessageBox]::Show("You cannot select both 'User must change password at next logon' and 'User cannot change password' for the same user.","Warning",0,"Warning")
			$UAADchkbxCannotChangePass.Checked = $false
		}	
	}
	$UAADchkbxPassNeverExpires_CheckedChanged={
		if(($UAADchkbxPassNeverExpires.Checked -eq $true) -and ($UAADchkbxChangePassNextLogon.Checked -eq $true)){
			[System.Windows.Forms.MessageBox]::Show("You have selected 'Password never expires'. The user will not be required to change the password at next logon.","Warning",0,"Warning")		
			$UAADchkbxChangePassNextLogon.Checked = $false
		}
	}
	$UAADlnklblOU_LinkClicked=[System.Windows.Forms.LinkLabelLinkClickedEventHandler]{
	#Event Argument: $_ = [System.Windows.Forms.LinkLabelLinkClickedEventArgs]
		if((Call-OUPicker_pff) -eq "OK"){
			$UAADtxtbxOU.Text = $OUPicker_TV
		}
	}
	#endregion UA CheckedChanged
	#endregion UserAdministration
	#region End
	$MenuFileExit_Click={
		clear
		$MainForm.Close()
	}
	#region Process other Key Presses "Enter", "Esc" ###
	$MainForm.KeyPreview = $True
	$MainForm.Add_KeyDown({
		if($_.KeyCode -eq "Enter"){
			if($txtbxUIEmpNo.get_Focused()){ITMTRun-UISearch}
			if($txtbxCIComputer.get_Focused()){$btnCISearch.PerformClick()}
			if($UAADtxtbxEmpNo.get_Focused()){$UAbtnSearch.PerformClick()}
		}
	})
	$MainForm.Add_KeyDown({
		if($_.KeyCode -eq "Escape"){
			clear	
			$MainForm.Close()
		}
	})
	#endregion
	$lstviewUIGroups_MouseDoubleClick=[System.Windows.Forms.MouseEventHandler]{
	#Event Argument: $_ = [System.Windows.Forms.MouseEventArgs]
		$GroupName = $lstviewUIGroups.SelectedItems[0].Text
		if(Call-SecurityGroupMembers_pff -GroupName $GroupName -eq "Yes"){
			$user = Invoke-Command -Session $sAD -ScriptBlock {Get-ADUser -Filter "displayName -eq '$($args[0])'"} -ArgumentList @($SecurityGroupMembers_SelectedResult)
			$txtbxUIEmpNo.Text = $user.samAccountName
			ITMTRun-UISearch
		}	
	}
	#endregion end
	
	
	$UAADLnklblSecAdd_LinkClicked=[System.Windows.Forms.LinkLabelLinkClickedEventHandler]{
	#Event Argument: $_ = [System.Windows.Forms.LinkLabelLinkClickedEventArgs]
		#TODO: Place custom script here
		
	}
	
	$UAADlnklblEditLogOnTo_LinkClicked=[System.Windows.Forms.LinkLabelLinkClickedEventHandler]{
	#Event Argument: $_ = [System.Windows.Forms.LinkLabelLinkClickedEventArgs]
		#TODO: Place custom script here
		
	}
	
	$UALyncLnklblDelete_LinkClicked=[System.Windows.Forms.LinkLabelLinkClickedEventHandler]{
	#Event Argument: $_ = [System.Windows.Forms.LinkLabelLinkClickedEventArgs]
		#TODO: Place custom script here
		
	}
	
	$UAExchLnklblDelete_LinkClicked=[System.Windows.Forms.LinkLabelLinkClickedEventHandler]{
	#Event Argument: $_ = [System.Windows.Forms.LinkLabelLinkClickedEventArgs]
		#TODO: Place custom script here
		
	}
	
	$UALyncbtnCreateLyncAccount_Click={
		#TODO: Place custom script here
		
	}
	
	$UAExchBtnCreateExchangeAccount_Click={
		#TODO: Place custom script here
		
	}
		# --End User Generated Script--
	#----------------------------------------------
	#region Generated Events
	#----------------------------------------------
	
	$Form_StateCorrection_Load=
	{
		#Correct the initial state of the form to prevent the .Net maximized form issue
		$MainForm.WindowState = $InitialFormWindowState
	}
	
	$Form_StoreValues_Closing=
	{
		#Store the control values
		$script:MainForm_UALyncTxtbxSipAddress = $UALyncTxtbxSipAddress.Text
		$script:MainForm_UALyncCmbbxUserPool = $UALyncCmbbxUserPool.Text
		$script:MainForm_UALyncCmbbxConfPolicy = $UALyncCmbbxConfPolicy.Text
		$script:MainForm_UALyncCmbbxEAP = $UALyncCmbbxEAP.Text
		$script:MainForm_UAADtxtbxOU = $UAADtxtbxOU.Text
		$script:MainForm_UAADtxtbxDisplayName = $UAADtxtbxDisplayName.Text
		$script:MainForm_UAADtxtbxTitle = $UAADtxtbxTitle.Text
		$script:MainForm_UAADlvLogonto = $UAADlvLogonto.SelectedItems
		$script:MainForm_UAADlvSecGroups = $UAADlvSecGroups.SelectedItems
		$script:MainForm_UAADcldrAccountExpires = $UAADcldrAccountExpires.Value
		$script:MainForm_UAADrbEndOf = $UAADrbEndOf.Checked
		$script:MainForm_UAADrbNever = $UAADrbNever.Checked
		$script:MainForm_UAADchkbxAccountDisabled = $UAADchkbxAccountDisabled.Checked
		$script:MainForm_UAADchkbxPassNeverExpires = $UAADchkbxPassNeverExpires.Checked
		$script:MainForm_UAADchkbxCannotChangePass = $UAADchkbxCannotChangePass.Checked
		$script:MainForm_UAADchkbxChangePassNextLogon = $UAADchkbxChangePassNextLogon.Checked
		$script:MainForm_UAADtxtbxLocalPath = $UAADtxtbxLocalPath.Text
		$script:MainForm_UAADcmbbxDriveLetter = $UAADcmbbxDriveLetter.Text
		$script:MainForm_UAADrbConnect = $UAADrbConnect.Checked
		$script:MainForm_UAADrbLocalPath = $UAADrbLocalPath.Checked
		$script:MainForm_UAADtxtbxHomePath = $UAADtxtbxHomePath.Text
		$script:MainForm_UAADtxtbxLogonScript = $UAADtxtbxLogonScript.Text
		$script:MainForm_UAADtxtbxProfilePath = $UAADtxtbxProfilePath.Text
		$script:MainForm_UAADtxtbxInitial = $UAADtxtbxInitial.Text
		$script:MainForm_UAADtxtbxPhone = $UAADtxtbxPhone.Text
		$script:MainForm_UAADtxtbxOffice = $UAADtxtbxOffice.Text
		$script:MainForm_UAADtxtbxDesc = $UAADtxtbxDesc.Text
		$script:MainForm_UAADcmbbxCompany = $UAADcmbbxCompany.Text
		$script:MainForm_UAADtxtbxLN = $UAADtxtbxLN.Text
		$script:MainForm_UAADtxtbxEmpNo = $UAADtxtbxEmpNo.Text
		$script:MainForm_UAADtxtbxFN = $UAADtxtbxFN.Text
		$script:MainForm_UAExchLvMessagingAddresses = $UAExchLvMessagingAddresses.SelectedItems
		$script:MainForm_UAExchTxtbxMBProhibit = $UAExchTxtbxMBProhibit.Text
		$script:MainForm_UAExchTxtbxMBWarning = $UAExchTxtbxMBWarning.Text
		$script:MainForm_UAExchChkbxUseMBDefaults = $UAExchChkbxUseMBDefaults.Checked
		$script:MainForm_UAExchChkbxMBProhibit = $UAExchChkbxMBProhibit.Checked
		$script:MainForm_UAExchChkbxMBWarning = $UAExchChkbxMBWarning.Checked
		$script:MainForm_UAExchTxtbxAlias = $UAExchTxtbxAlias.Text
		$script:MainForm_UAExchTxtbxDN = $UAExchTxtbxDN.Text
		$script:MainForm_UAExchChkbxHideAddressBook = $UAExchChkbxHideAddressBook.Checked
		$script:MainForm_UAExchCmbbxDatabase = $UAExchCmbbxDatabase.Text
		$script:MainForm_UAADCmbbxStatus = $UAADCmbbxStatus.Text
	}

	
	$Form_Cleanup_FormClosed=
	{
		#Remove all event handlers from the controls
		try
		{
			$UALyncLnklblDelete.remove_LinkClicked($UALyncLnklblDelete_LinkClicked)
			$UALyncbtnCreateLyncAccount.remove_Click($UALyncbtnCreateLyncAccount_Click)
			$UAADbtnLookup.remove_Click($UAADbtnLookup_Click)
			$UAADlnklblOU.remove_LinkClicked($UAADlnklblOU_LinkClicked)
			$UAbtnClear.remove_Click($UAbtnClear_Click)
			$UAbtnExecute.remove_Click($UAbtnExecute_Click)
			$UAADrbEndOf.remove_CheckedChanged($UAADrbEndOf_CheckedChanged)
			$UAADrbNever.remove_CheckedChanged($UAADrbNever_CheckedChanged)
			$UAADchkbxPassNeverExpires.remove_CheckedChanged($UAADchkbxPassNeverExpires_CheckedChanged)
			$UAADchkbxCannotChangePass.remove_CheckedChanged($UAADchkbxCannotChangePass_CheckedChanged)
			$UAADchkbxChangePassNextLogon.remove_CheckedChanged($UAADchkbxChangePassNextLogon_CheckedChanged)
			$UAADrbConnect.remove_CheckedChanged($UAADrbConnect_CheckedChanged)
			$UAADrbLocalPath.remove_CheckedChanged($UAADrbLocalPath_CheckedChanged)
			$UAbtnSearch.remove_Click($UAbtnSearch_Click)
			$UAADlnklblEditLogOnTo.remove_LinkClicked($UAADlnklblEditLogOnTo_LinkClicked)
			$UAADLnklblSecMirror.remove_LinkClicked($UAADLnklblSecMirror_LinkClicked)
			$UAADLnklblSecRemove.remove_LinkClicked($UAADLnklblSecRemove_LinkClicked)
			$UAADLnklblSecAdd.remove_LinkClicked($UAADLnklblSecAdd_LinkClicked)
			$UAExchLnklblDelete.remove_LinkClicked($UAExchLnklblDelete_LinkClicked)
			$UAExchLnklblAdd.remove_LinkClicked($UAExchLnklblAdd_LinkClicked)
			$UAExchChkbxUseMBDefaults.remove_CheckedChanged($UAExchChkbxUseMBDefaults_CheckedChanged)
			$UAExchChkbxMBProhibit.remove_CheckedChanged($UAExchChkbxMBProhibit_CheckedChanged)
			$UAExchChkbxMBWarning.remove_CheckedChanged($UAExchChkbxMBWarning_CheckedChanged)
			$UAExchBtnCreateExchangeAccount.remove_Click($UAExchBtnCreateExchangeAccount_Click)
			$UAExchLnklblMakePrimary.remove_LinkClicked($UAExchLnklblMakePrimary_LinkClicked)
			$UAExchLnklblRemove.remove_LinkClicked($UAExchLnklblRemove_LinkClicked)
			$MainForm.remove_Load($OnLoadFormEvent)
			$menuFileExit.remove_Click($MenuFileExit_Click)
			$MainForm.remove_Load($Form_StateCorrection_Load)
			$MainForm.remove_Closing($Form_StoreValues_Closing)
			$MainForm.remove_FormClosed($Form_Cleanup_FormClosed)
		}
		catch [Exception]
		{ }
	}
	#endregion Generated Events

	#----------------------------------------------
	#region Generated Form Code
	#----------------------------------------------
	#
	# MainForm
	#
	$MainForm.Controls.Add($menu)
	$MainForm.Controls.Add($TCAdmin)
	$MainForm.ClientSize = '853, 662'
	$MainForm.Name = "MainForm"
	$MainForm.StartPosition = 'CenterScreen'
	$MainForm.Text = "User Administration Tool"
	$MainForm.add_Load($OnLoadFormEvent)
	#
	# menu
	#
	[void]$menu.Items.Add($menuFile)
	[void]$menu.Items.Add($menuView)
	[void]$menu.Items.Add($helpToolStripMenuItem)
	$menu.Location = '0, 0'
	$menu.Name = "menu"
	$menu.Size = '853, 24'
	$menu.TabIndex = 5
	$menu.Text = "MenuStrip1"
	#
	# TCAdmin
	#
	$TCAdmin.Controls.Add($UserAdministration)
	$TCAdmin.Anchor = 'Top, Bottom, Left, Right'
	$TCAdmin.Location = '0, 24'
	$TCAdmin.Name = "TCAdmin"
	$TCAdmin.SelectedIndex = 0
	$TCAdmin.Size = '853, 606'
	$TCAdmin.TabIndex = 8
	#
	# UserAdministration
	#
	$UserAdministration.Controls.Add($groupBox13)
	$UserAdministration.Controls.Add($UAADbtnLookup)
	$UserAdministration.Controls.Add($groupBox7)
	$UserAdministration.Controls.Add($groupBox12)
	$UserAdministration.Controls.Add($UAlblADStatus)
	$UserAdministration.Controls.Add($UAADCmbbxStatus)
	$UserAdministration.Location = '4, 24'
	$UserAdministration.Name = "UserAdministration"
	$UserAdministration.Padding = '3, 3, 3, 3'
	$UserAdministration.Size = '845, 578'
	$UserAdministration.TabIndex = 0
	$UserAdministration.Text = "User Adminsitration"
	$UserAdministration.UseVisualStyleBackColor = $True
	#
	# groupBox13
	#
	$groupBox13.Controls.Add($UALyncLnklblDelete)
	$groupBox13.Controls.Add($UALyncTxtbxSipAddress)
	$groupBox13.Controls.Add($UALyncLblSIPAddress)
	$groupBox13.Controls.Add($UALyncCmbbxUserPool)
	$groupBox13.Controls.Add($UALyncLblUserPool)
	$groupBox13.Controls.Add($UALyncCmbbxConfPolicy)
	$groupBox13.Controls.Add($UALyncLblConferencingPolicy)
	$groupBox13.Controls.Add($UALyncCmbbxEAP)
	$groupBox13.Controls.Add($UALyncLblExternalAccessPolicy)
	$groupBox13.Controls.Add($UALyncbtnCreateLyncAccount)
	$groupBox13.BackColor = 'Transparent'
	$groupBox13.Location = '543, 63'
	$groupBox13.Name = "groupBox13"
	$groupBox13.Size = '296, 131'
	$groupBox13.TabIndex = 53
	$groupBox13.TabStop = $False
	$groupBox13.Text = "Lync"
	#
	# UALyncLnklblDelete
	#
	$UALyncLnklblDelete.BackColor = 'AppWorkspace'
	$UALyncLnklblDelete.Location = '218, -6'
	$UALyncLnklblDelete.Name = "UALyncLnklblDelete"
	$UALyncLnklblDelete.Size = '52, 23'
	$UALyncLnklblDelete.TabIndex = 88
	$UALyncLnklblDelete.TabStop = $True
	$UALyncLnklblDelete.Text = "Delete"
	$UALyncLnklblDelete.TextAlign = 'MiddleCenter'
	$UALyncLnklblDelete.add_LinkClicked($UALyncLnklblDelete_LinkClicked)
	#
	# UALyncTxtbxSipAddress
	#
	$UALyncTxtbxSipAddress.Location = '130, 20'
	$UALyncTxtbxSipAddress.Name = "UALyncTxtbxSipAddress"
	$UALyncTxtbxSipAddress.Size = '153, 20'
	$UALyncTxtbxSipAddress.TabIndex = 60
	#
	# UALyncLblSIPAddress
	#
	$UALyncLblSIPAddress.Location = '9, 24'
	$UALyncLblSIPAddress.Name = "UALyncLblSIPAddress"
	$UALyncLblSIPAddress.Size = '100, 23'
	$UALyncLblSIPAddress.TabIndex = 59
	$UALyncLblSIPAddress.Text = "SIP Address:"
	#
	# UALyncCmbbxUserPool
	#
	$UALyncCmbbxUserPool.FormattingEnabled = $True
	[void]$UALyncCmbbxUserPool.Items.Add("ATLLYNCPL01.skywest.com")
	[void]$UALyncCmbbxUserPool.Items.Add("SGULYNCPL01.skywest.com")
	$UALyncCmbbxUserPool.Location = '130, 76'
	$UALyncCmbbxUserPool.Name = "UALyncCmbbxUserPool"
	$UALyncCmbbxUserPool.Size = '153, 21'
	$UALyncCmbbxUserPool.TabIndex = 58
	#
	# UALyncLblUserPool
	#
	$UALyncLblUserPool.AutoSize = $True
	$UALyncLblUserPool.Location = '7, 79'
	$UALyncLblUserPool.Name = "UALyncLblUserPool"
	$UALyncLblUserPool.Size = '56, 13'
	$UALyncLblUserPool.TabIndex = 57
	$UALyncLblUserPool.Text = "User Pool:"
	#
	# UALyncCmbbxConfPolicy
	#
	$UALyncCmbbxConfPolicy.FormattingEnabled = $True
	[void]$UALyncCmbbxConfPolicy.Items.Add("Default Policy")
	[void]$UALyncCmbbxConfPolicy.Items.Add("DEV")
	[void]$UALyncCmbbxConfPolicy.Items.Add("Everything")
	[void]$UALyncCmbbxConfPolicy.Items.Add("L2 ATL")
	[void]$UALyncCmbbxConfPolicy.Items.Add("Live Meeting 100 Users")
	[void]$UALyncCmbbxConfPolicy.Items.Add("Live Meeting 65 Users")
	[void]$UALyncCmbbxConfPolicy.Items.Add("Live Meeting OO")
	[void]$UALyncCmbbxConfPolicy.Items.Add("Policy 1 (High)")
	[void]$UALyncCmbbxConfPolicy.Items.Add("Policy 2 (Medium High)")
	[void]$UALyncCmbbxConfPolicy.Items.Add("Policy 3 (Medium Low)")
	[void]$UALyncCmbbxConfPolicy.Items.Add("Policy 4 (Low)")
	[void]$UALyncCmbbxConfPolicy.Items.Add("SE")
	$UALyncCmbbxConfPolicy.Location = '130, 104'
	$UALyncCmbbxConfPolicy.Name = "UALyncCmbbxConfPolicy"
	$UALyncCmbbxConfPolicy.Size = '153, 21'
	$UALyncCmbbxConfPolicy.TabIndex = 56
	#
	# UALyncLblConferencingPolicy
	#
	$UALyncLblConferencingPolicy.AutoSize = $True
	$UALyncLblConferencingPolicy.Location = '7, 107'
	$UALyncLblConferencingPolicy.Name = "UALyncLblConferencingPolicy"
	$UALyncLblConferencingPolicy.Size = '104, 13'
	$UALyncLblConferencingPolicy.TabIndex = 55
	$UALyncLblConferencingPolicy.Text = "Conferencing Policy:"
	#
	# UALyncCmbbxEAP
	#
	$UALyncCmbbxEAP.FormattingEnabled = $True
	[void]$UALyncCmbbxEAP.Items.Add("Enable Lync (Default)")
	[void]$UALyncCmbbxEAP.Items.Add("Enable Lync (Allow No Access)")
	[void]$UALyncCmbbxEAP.Items.Add("Enable Lync (Allow Outside Access)")
	[void]$UALyncCmbbxEAP.Items.Add("Enable Lync (Allow Federation)")
	[void]$UALyncCmbbxEAP.Items.Add("Enable Lync (Allow Federation+Outside Access)")
	[void]$UALyncCmbbxEAP.Items.Add("Disable Lync")
	$UALyncCmbbxEAP.Location = '130, 49'
	$UALyncCmbbxEAP.Name = "UALyncCmbbxEAP"
	$UALyncCmbbxEAP.Size = '153, 21'
	$UALyncCmbbxEAP.TabIndex = 54
	#
	# UALyncLblExternalAccessPolicy
	#
	$UALyncLblExternalAccessPolicy.AutoSize = $True
	$UALyncLblExternalAccessPolicy.Location = '7, 52'
	$UALyncLblExternalAccessPolicy.Name = "UALyncLblExternalAccessPolicy"
	$UALyncLblExternalAccessPolicy.Size = '117, 13'
	$UALyncLblExternalAccessPolicy.TabIndex = 53
	$UALyncLblExternalAccessPolicy.Text = "External Access Policy:"
	#
	# UALyncbtnCreateLyncAccount
	#
	$UALyncbtnCreateLyncAccount.Location = '12, 17'
	$UALyncbtnCreateLyncAccount.Name = "UALyncbtnCreateLyncAccount"
	$UALyncbtnCreateLyncAccount.Size = '271, 23'
	$UALyncbtnCreateLyncAccount.TabIndex = 61
	$UALyncbtnCreateLyncAccount.Text = "Create Lync Account"
	$UALyncbtnCreateLyncAccount.UseVisualStyleBackColor = $True
	$UALyncbtnCreateLyncAccount.Visible = $False
	$UALyncbtnCreateLyncAccount.add_Click($UALyncbtnCreateLyncAccount_Click)
	#
	# UAADbtnLookup
	#
	$UAADbtnLookup.Location = '552, 34'
	$UAADbtnLookup.Name = "UAADbtnLookup"
	$UAADbtnLookup.Size = '86, 23'
	$UAADbtnLookup.TabIndex = 78
	$UAADbtnLookup.Text = "Lookup"
	$UAADbtnLookup.UseVisualStyleBackColor = $True
	$UAADbtnLookup.add_Click($UAADbtnLookup_Click)
	#
	# groupBox7
	#
	$groupBox7.Controls.Add($UAADlnklblOU)
	$groupBox7.Controls.Add($UAADtxtbxOU)
	$groupBox7.Controls.Add($UAbtnClear)
	$groupBox7.Controls.Add($UAADtxtbxDisplayName)
	$groupBox7.Controls.Add($label13)
	$groupBox7.Controls.Add($UAADtxtbxTitle)
	$groupBox7.Controls.Add($UAADlvLogonto)
	$groupBox7.Controls.Add($UAADlvSecGroups)
	$groupBox7.Controls.Add($UAbtnExecute)
	$groupBox7.Controls.Add($groupbox1)
	$groupBox7.Controls.Add($groupbox2)
	$groupBox7.Controls.Add($groupbox3)
	$groupBox7.Controls.Add($groupbox4)
	$groupBox7.Controls.Add($labelInitial)
	$groupBox7.Controls.Add($UAADlblGroups)
	$groupBox7.Controls.Add($UAADtxtbxInitial)
	$groupBox7.Controls.Add($UAADtxtbxPhone)
	$groupBox7.Controls.Add($labelTelephoneNumber)
	$groupBox7.Controls.Add($UAADtxtbxOffice)
	$groupBox7.Controls.Add($labelOffice)
	$groupBox7.Controls.Add($UAADtxtbxDesc)
	$groupBox7.Controls.Add($labelDescription)
	$groupBox7.Controls.Add($UAADcmbbxCompany)
	$groupBox7.Controls.Add($UAADtxtbxLN)
	$groupBox7.Controls.Add($UAbtnSearch)
	$groupBox7.Controls.Add($label21)
	$groupBox7.Controls.Add($labelLastName)
	$groupBox7.Controls.Add($labelFirstName)
	$groupBox7.Controls.Add($UAADtxtbxEmpNo)
	$groupBox7.Controls.Add($UAADtxtbxFN)
	$groupBox7.Controls.Add($labelCompany)
	$groupBox7.Controls.Add($labelJobTitle)
	$groupBox7.Controls.Add($labelLogOnTo)
	$groupBox7.Controls.Add($UAADlnklblEditLogOnTo)
	$groupBox7.Controls.Add($UAADLnklblSecMirror)
	$groupBox7.Controls.Add($UAADLnklblSecRemove)
	$groupBox7.Controls.Add($UAADLnklblSecAdd)
	$groupBox7.BackColor = 'Transparent'
	$groupBox7.Location = '10, 4'
	$groupBox7.Name = "groupBox7"
	$groupBox7.Size = '527, 559'
	$groupBox7.TabIndex = 55
	$groupBox7.TabStop = $False
	$groupBox7.Text = "Active Directory"
	#
	# UAADlnklblOU
	#
	$UAADlnklblOU.Location = '6, 233'
	$UAADlnklblOU.Name = "UAADlnklblOU"
	$UAADlnklblOU.Size = '100, 23'
	$UAADlnklblOU.TabIndex = 84
	$UAADlnklblOU.TabStop = $True
	$UAADlnklblOU.Text = "Organizational Unit:"
	$UAADlnklblOU.TextAlign = 'MiddleLeft'
	$UAADlnklblOU.add_LinkClicked($UAADlnklblOU_LinkClicked)
	#
	# UAADtxtbxOU
	#
	$UAADtxtbxOU.Location = '106, 235'
	$UAADtxtbxOU.Name = "UAADtxtbxOU"
	$UAADtxtbxOU.ReadOnly = $True
	$UAADtxtbxOU.Size = '177, 20'
	$UAADtxtbxOU.TabIndex = 83
	#
	# UAbtnClear
	#
	$UAbtnClear.Location = '447, 15'
	$UAbtnClear.Name = "UAbtnClear"
	$UAbtnClear.Size = '75, 23'
	$UAbtnClear.TabIndex = 79
	$UAbtnClear.Text = "Clear"
	$UAbtnClear.UseVisualStyleBackColor = $True
	$UAbtnClear.add_Click($UAbtnClear_Click)
	#
	# UAADtxtbxDisplayName
	#
	$UAADtxtbxDisplayName.Location = '106, 71'
	$UAADtxtbxDisplayName.Name = "UAADtxtbxDisplayName"
	$UAADtxtbxDisplayName.Size = '177, 20'
	$UAADtxtbxDisplayName.TabIndex = 76
	#
	# label13
	#
	$label13.AutoSize = $True
	$label13.Location = '6, 74'
	$label13.Name = "label13"
	$label13.Size = '75, 13'
	$label13.TabIndex = 77
	$label13.Text = "Display Name:"
	#
	# UAADtxtbxTitle
	#
	$UAADtxtbxTitle.Location = '106, 209'
	$UAADtxtbxTitle.Name = "UAADtxtbxTitle"
	$UAADtxtbxTitle.Size = '177, 20'
	$UAADtxtbxTitle.TabIndex = 75
	#
	# UAADlvLogonto
	#
	[void]$UAADlvLogonto.Columns.Add($ComputerName)
	$UAADlvLogonto.Location = '9, 281'
	$UAADlvLogonto.Name = "UAADlvLogonto"
	$UAADlvLogonto.Size = '274, 92'
	$UAADlvLogonto.TabIndex = 73
	$UAADlvLogonto.UseCompatibleStateImageBehavior = $False
	$UAADlvLogonto.View = 'Details'
	#
	# UAADlvSecGroups
	#
	[void]$UAADlvSecGroups.Columns.Add($GroupName)
	$UAADlvSecGroups.Location = '289, 82'
	$UAADlvSecGroups.Name = "UAADlvSecGroups"
	$UAADlvSecGroups.Size = '231, 291'
	$UAADlvSecGroups.TabIndex = 70
	$UAADlvSecGroups.UseCompatibleStateImageBehavior = $False
	$UAADlvSecGroups.View = 'Details'
	#
	# UAbtnExecute
	#
	$UAbtnExecute.Location = '346, 15'
	$UAbtnExecute.Name = "UAbtnExecute"
	$UAbtnExecute.Size = '95, 23'
	$UAbtnExecute.TabIndex = 52
	$UAbtnExecute.Text = "Execute"
	$UAbtnExecute.UseVisualStyleBackColor = $True
	$UAbtnExecute.add_Click($UAbtnExecute_Click)
	#
	# groupbox1
	#
	$groupbox1.Controls.Add($UAADcldrAccountExpires)
	$groupbox1.Controls.Add($UAADrbEndOf)
	$groupbox1.Controls.Add($UAADrbNever)
	$groupbox1.Location = '323, 487'
	$groupbox1.Name = "groupbox1"
	$groupbox1.Size = '197, 65'
	$groupbox1.TabIndex = 68
	$groupbox1.TabStop = $False
	$groupbox1.Text = "Account Expires"
	#
	# UAADcldrAccountExpires
	#
	$UAADcldrAccountExpires.Location = '7, 39'
	$UAADcldrAccountExpires.Name = "UAADcldrAccountExpires"
	$UAADcldrAccountExpires.Size = '183, 20'
	$UAADcldrAccountExpires.TabIndex = 2
	$UAADcldrAccountExpires.Value = "10/02/2013 08:03:29"
	#
	# UAADrbEndOf
	#
	$UAADrbEndOf.Location = '9, 16'
	$UAADrbEndOf.Name = "UAADrbEndOf"
	$UAADrbEndOf.Size = '68, 24'
	$UAADrbEndOf.TabIndex = 1
	$UAADrbEndOf.TabStop = $True
	$UAADrbEndOf.Text = "End of:"
	$UAADrbEndOf.UseVisualStyleBackColor = $True
	$UAADrbEndOf.add_CheckedChanged($UAADrbEndOf_CheckedChanged)
	#
	# UAADrbNever
	#
	$UAADrbNever.Location = '130, 16'
	$UAADrbNever.Name = "UAADrbNever"
	$UAADrbNever.Size = '60, 24'
	$UAADrbNever.TabIndex = 0
	$UAADrbNever.TabStop = $True
	$UAADrbNever.Text = "Never"
	$UAADrbNever.UseVisualStyleBackColor = $True
	$UAADrbNever.add_CheckedChanged($UAADrbNever_CheckedChanged)
	#
	# groupbox2
	#
	$groupbox2.Controls.Add($UAADchkbxAccountDisabled)
	$groupbox2.Controls.Add($UAADchkbxPassNeverExpires)
	$groupbox2.Controls.Add($UAADchkbxCannotChangePass)
	$groupbox2.Controls.Add($UAADchkbxChangePassNextLogon)
	$groupbox2.Location = '323, 378'
	$groupbox2.Name = "groupbox2"
	$groupbox2.Size = '197, 103'
	$groupbox2.TabIndex = 67
	$groupbox2.TabStop = $False
	$groupbox2.Text = "Account Options"
	#
	# UAADchkbxAccountDisabled
	#
	$UAADchkbxAccountDisabled.Location = '10, 75'
	$UAADchkbxAccountDisabled.Name = "UAADchkbxAccountDisabled"
	$UAADchkbxAccountDisabled.Size = '174, 24'
	$UAADchkbxAccountDisabled.TabIndex = 4
	$UAADchkbxAccountDisabled.Text = "Account is Disabled"
	$UAADchkbxAccountDisabled.UseVisualStyleBackColor = $True
	#
	# UAADchkbxPassNeverExpires
	#
	$UAADchkbxPassNeverExpires.Location = '10, 56'
	$UAADchkbxPassNeverExpires.Name = "UAADchkbxPassNeverExpires"
	$UAADchkbxPassNeverExpires.Size = '174, 24'
	$UAADchkbxPassNeverExpires.TabIndex = 3
	$UAADchkbxPassNeverExpires.Text = "Pass Never Expires"
	$UAADchkbxPassNeverExpires.UseVisualStyleBackColor = $True
	$UAADchkbxPassNeverExpires.add_CheckedChanged($UAADchkbxPassNeverExpires_CheckedChanged)
	#
	# UAADchkbxCannotChangePass
	#
	$UAADchkbxCannotChangePass.Location = '10, 37'
	$UAADchkbxCannotChangePass.Name = "UAADchkbxCannotChangePass"
	$UAADchkbxCannotChangePass.Size = '174, 24'
	$UAADchkbxCannotChangePass.TabIndex = 2
	$UAADchkbxCannotChangePass.Text = "User Cannot Change Pass"
	$UAADchkbxCannotChangePass.UseVisualStyleBackColor = $True
	$UAADchkbxCannotChangePass.add_CheckedChanged($UAADchkbxCannotChangePass_CheckedChanged)
	#
	# UAADchkbxChangePassNextLogon
	#
	$UAADchkbxChangePassNextLogon.Location = '10, 18'
	$UAADchkbxChangePassNextLogon.Name = "UAADchkbxChangePassNextLogon"
	$UAADchkbxChangePassNextLogon.Size = '174, 24'
	$UAADchkbxChangePassNextLogon.TabIndex = 1
	$UAADchkbxChangePassNextLogon.Text = "Change Pass Next Logon"
	$UAADchkbxChangePassNextLogon.UseVisualStyleBackColor = $True
	$UAADchkbxChangePassNextLogon.add_CheckedChanged($UAADchkbxChangePassNextLogon_CheckedChanged)
	#
	# groupbox3
	#
	$groupbox3.Controls.Add($UAADtxtbxLocalPath)
	$groupbox3.Controls.Add($UAADcmbbxDriveLetter)
	$groupbox3.Controls.Add($UAADrbConnect)
	$groupbox3.Controls.Add($UAADrbLocalPath)
	$groupbox3.Controls.Add($UAADtxtbxHomePath)
	$groupbox3.Controls.Add($labelTo)
	$groupbox3.Location = '4, 470'
	$groupbox3.Name = "groupbox3"
	$groupbox3.Size = '313, 82'
	$groupbox3.TabIndex = 66
	$groupbox3.TabStop = $False
	$groupbox3.Text = "Home Folder"
	#
	# UAADtxtbxLocalPath
	#
	$UAADtxtbxLocalPath.Location = '94, 20'
	$UAADtxtbxLocalPath.Name = "UAADtxtbxLocalPath"
	$UAADtxtbxLocalPath.Size = '212, 20'
	$UAADtxtbxLocalPath.TabIndex = 68
	#
	# UAADcmbbxDriveLetter
	#
	$UAADcmbbxDriveLetter.FormattingEnabled = $True
	[void]$UAADcmbbxDriveLetter.Items.Add("D:")
	[void]$UAADcmbbxDriveLetter.Items.Add("E:")
	[void]$UAADcmbbxDriveLetter.Items.Add("F:")
	[void]$UAADcmbbxDriveLetter.Items.Add("G:")
	[void]$UAADcmbbxDriveLetter.Items.Add("H:")
	[void]$UAADcmbbxDriveLetter.Items.Add("I:")
	[void]$UAADcmbbxDriveLetter.Items.Add("J:")
	[void]$UAADcmbbxDriveLetter.Items.Add("K:")
	[void]$UAADcmbbxDriveLetter.Items.Add("L:")
	[void]$UAADcmbbxDriveLetter.Items.Add("M:")
	[void]$UAADcmbbxDriveLetter.Items.Add("N:")
	[void]$UAADcmbbxDriveLetter.Items.Add("O:")
	[void]$UAADcmbbxDriveLetter.Items.Add("P:")
	[void]$UAADcmbbxDriveLetter.Items.Add("Q:")
	[void]$UAADcmbbxDriveLetter.Items.Add("R:")
	[void]$UAADcmbbxDriveLetter.Items.Add("S:")
	[void]$UAADcmbbxDriveLetter.Items.Add("T:")
	[void]$UAADcmbbxDriveLetter.Items.Add("U:")
	[void]$UAADcmbbxDriveLetter.Items.Add("V:")
	[void]$UAADcmbbxDriveLetter.Items.Add("W:")
	[void]$UAADcmbbxDriveLetter.Items.Add("X:")
	[void]$UAADcmbbxDriveLetter.Items.Add("Y:")
	[void]$UAADcmbbxDriveLetter.Items.Add("Z:")
	$UAADcmbbxDriveLetter.Location = '94, 46'
	$UAADcmbbxDriveLetter.Name = "UAADcmbbxDriveLetter"
	$UAADcmbbxDriveLetter.Size = '45, 21'
	$UAADcmbbxDriveLetter.TabIndex = 67
	#
	# UAADrbConnect
	#
	$UAADrbConnect.Location = '9, 44'
	$UAADrbConnect.Name = "UAADrbConnect"
	$UAADrbConnect.Size = '75, 24'
	$UAADrbConnect.TabIndex = 66
	$UAADrbConnect.TabStop = $True
	$UAADrbConnect.Text = "Connect:"
	$UAADrbConnect.UseVisualStyleBackColor = $True
	$UAADrbConnect.add_CheckedChanged($UAADrbConnect_CheckedChanged)
	#
	# UAADrbLocalPath
	#
	$UAADrbLocalPath.Location = '9, 17'
	$UAADrbLocalPath.Name = "UAADrbLocalPath"
	$UAADrbLocalPath.Size = '84, 24'
	$UAADrbLocalPath.TabIndex = 65
	$UAADrbLocalPath.TabStop = $True
	$UAADrbLocalPath.Text = "Local Path:"
	$UAADrbLocalPath.UseVisualStyleBackColor = $True
	$UAADrbLocalPath.add_CheckedChanged($UAADrbLocalPath_CheckedChanged)
	#
	# UAADtxtbxHomePath
	#
	$UAADtxtbxHomePath.Location = '172, 47'
	$UAADtxtbxHomePath.Name = "UAADtxtbxHomePath"
	$UAADtxtbxHomePath.Size = '134, 20'
	$UAADtxtbxHomePath.TabIndex = 63
	#
	# labelTo
	#
	$labelTo.AutoSize = $True
	$labelTo.Location = '144, 50'
	$labelTo.Name = "labelTo"
	$labelTo.Size = '23, 13'
	$labelTo.TabIndex = 64
	$labelTo.Text = "To:"
	#
	# groupbox4
	#
	$groupbox4.Controls.Add($labelProfilePath)
	$groupbox4.Controls.Add($UAADtxtbxLogonScript)
	$groupbox4.Controls.Add($UAADtxtbxProfilePath)
	$groupbox4.Controls.Add($labelLogonScript)
	$groupbox4.Location = '5, 378'
	$groupbox4.Name = "groupbox4"
	$groupbox4.Size = '312, 82'
	$groupbox4.TabIndex = 65
	$groupbox4.TabStop = $False
	$groupbox4.Text = "User Profile"
	#
	# labelProfilePath
	#
	$labelProfilePath.AutoSize = $True
	$labelProfilePath.Location = '6, 22'
	$labelProfilePath.Name = "labelProfilePath"
	$labelProfilePath.Size = '64, 13'
	$labelProfilePath.TabIndex = 62
	$labelProfilePath.Text = "Profile Path:"
	#
	# UAADtxtbxLogonScript
	#
	$UAADtxtbxLogonScript.Location = '94, 47'
	$UAADtxtbxLogonScript.Name = "UAADtxtbxLogonScript"
	$UAADtxtbxLogonScript.Size = '211, 20'
	$UAADtxtbxLogonScript.TabIndex = 63
	#
	# UAADtxtbxProfilePath
	#
	$UAADtxtbxProfilePath.Location = '94, 19'
	$UAADtxtbxProfilePath.Name = "UAADtxtbxProfilePath"
	$UAADtxtbxProfilePath.Size = '211, 20'
	$UAADtxtbxProfilePath.TabIndex = 61
	#
	# labelLogonScript
	#
	$labelLogonScript.AutoSize = $True
	$labelLogonScript.Location = '6, 50'
	$labelLogonScript.Name = "labelLogonScript"
	$labelLogonScript.Size = '70, 13'
	$labelLogonScript.TabIndex = 64
	$labelLogonScript.Text = "Logon Script:"
	#
	# labelInitial
	#
	$labelInitial.AutoSize = $True
	$labelInitial.Location = '224, 46'
	$labelInitial.Name = "labelInitial"
	$labelInitial.Size = '34, 13'
	$labelInitial.TabIndex = 60
	$labelInitial.Text = "Initial:"
	#
	# UAADlblGroups
	#
	$UAADlblGroups.Font = "Microsoft Sans Serif, 8.25pt"
	$UAADlblGroups.Location = '292, 69'
	$UAADlblGroups.Name = "UAADlblGroups"
	$UAADlblGroups.Size = '100, 18'
	$UAADlblGroups.TabIndex = 51
	$UAADlblGroups.Text = "Sec/Dist Groups"
	#
	# UAADtxtbxInitial
	#
	$UAADtxtbxInitial.Location = '261, 43'
	$UAADtxtbxInitial.Name = "UAADtxtbxInitial"
	$UAADtxtbxInitial.Size = '36, 20'
	$UAADtxtbxInitial.TabIndex = 59
	#
	# UAADtxtbxPhone
	#
	$UAADtxtbxPhone.Location = '106, 154'
	$UAADtxtbxPhone.Name = "UAADtxtbxPhone"
	$UAADtxtbxPhone.Size = '177, 20'
	$UAADtxtbxPhone.TabIndex = 57
	#
	# labelTelephoneNumber
	#
	$labelTelephoneNumber.AutoSize = $True
	$labelTelephoneNumber.Location = '5, 154'
	$labelTelephoneNumber.Name = "labelTelephoneNumber"
	$labelTelephoneNumber.Size = '101, 13'
	$labelTelephoneNumber.TabIndex = 58
	$labelTelephoneNumber.Text = "Telephone Number:"
	#
	# UAADtxtbxOffice
	#
	$UAADtxtbxOffice.Location = '106, 126'
	$UAADtxtbxOffice.Name = "UAADtxtbxOffice"
	$UAADtxtbxOffice.Size = '177, 20'
	$UAADtxtbxOffice.TabIndex = 55
	#
	# labelOffice
	#
	$labelOffice.AutoSize = $True
	$labelOffice.Location = '6, 131'
	$labelOffice.Name = "labelOffice"
	$labelOffice.Size = '38, 13'
	$labelOffice.TabIndex = 56
	$labelOffice.Text = "Office:"
	#
	# UAADtxtbxDesc
	#
	$UAADtxtbxDesc.Location = '106, 97'
	$UAADtxtbxDesc.Name = "UAADtxtbxDesc"
	$UAADtxtbxDesc.Size = '177, 20'
	$UAADtxtbxDesc.TabIndex = 53
	#
	# labelDescription
	#
	$labelDescription.AutoSize = $True
	$labelDescription.Location = '6, 100'
	$labelDescription.Name = "labelDescription"
	$labelDescription.Size = '63, 13'
	$labelDescription.TabIndex = 54
	$labelDescription.Text = "Description:"
	#
	# UAADcmbbxCompany
	#
	$UAADcmbbxCompany.FormattingEnabled = $True
	[void]$UAADcmbbxCompany.Items.Add("ExpressJet")
	[void]$UAADcmbbxCompany.Items.Add("Skywest")
	$UAADcmbbxCompany.Location = '106, 182'
	$UAADcmbbxCompany.Name = "UAADcmbbxCompany"
	$UAADcmbbxCompany.Size = '177, 21'
	$UAADcmbbxCompany.TabIndex = 28
	#
	# UAADtxtbxLN
	#
	$UAADtxtbxLN.Location = '373, 43'
	$UAADtxtbxLN.Name = "UAADtxtbxLN"
	$UAADtxtbxLN.Size = '148, 20'
	$UAADtxtbxLN.TabIndex = 9
	#
	# UAbtnSearch
	#
	$UAbtnSearch.Location = '252, 15'
	$UAbtnSearch.Name = "UAbtnSearch"
	$UAbtnSearch.Size = '88, 23'
	$UAbtnSearch.TabIndex = 21
	$UAbtnSearch.Text = "Search"
	$UAbtnSearch.UseVisualStyleBackColor = $True
	$UAbtnSearch.add_Click($UAbtnSearch_Click)
	#
	# label21
	#
	$label21.AutoSize = $True
	$label21.Location = '6, 20'
	$label21.Name = "label21"
	$label21.Size = '73, 13'
	$label21.TabIndex = 11
	$label21.Text = "EmpNo/SAM:"
	#
	# labelLastName
	#
	$labelLastName.AutoSize = $True
	$labelLastName.Location = '309, 45'
	$labelLastName.Name = "labelLastName"
	$labelLastName.Size = '61, 13'
	$labelLastName.TabIndex = 12
	$labelLastName.Text = "Last Name:"
	#
	# labelFirstName
	#
	$labelFirstName.AutoSize = $True
	$labelFirstName.Location = '6, 45'
	$labelFirstName.Name = "labelFirstName"
	$labelFirstName.Size = '60, 13'
	$labelFirstName.TabIndex = 13
	$labelFirstName.Text = "First Name:"
	#
	# UAADtxtbxEmpNo
	#
	$UAADtxtbxEmpNo.Location = '106, 17'
	$UAADtxtbxEmpNo.Name = "UAADtxtbxEmpNo"
	$UAADtxtbxEmpNo.Size = '136, 20'
	$UAADtxtbxEmpNo.TabIndex = 8
	#
	# UAADtxtbxFN
	#
	$UAADtxtbxFN.Location = '106, 43'
	$UAADtxtbxFN.Name = "UAADtxtbxFN"
	$UAADtxtbxFN.Size = '112, 20'
	$UAADtxtbxFN.TabIndex = 10
	#
	# labelCompany
	#
	$labelCompany.AutoSize = $True
	$labelCompany.Location = '6, 182'
	$labelCompany.Name = "labelCompany"
	$labelCompany.Size = '54, 13'
	$labelCompany.TabIndex = 14
	$labelCompany.Text = "Company:"
	#
	# labelJobTitle
	#
	$labelJobTitle.AutoSize = $True
	$labelJobTitle.Location = '6, 212'
	$labelJobTitle.Name = "labelJobTitle"
	$labelJobTitle.Size = '50, 13'
	$labelJobTitle.TabIndex = 25
	$labelJobTitle.Text = "Job Title:"
	#
	# labelLogOnTo
	#
	$labelLogOnTo.Font = "Microsoft Sans Serif, 8.25pt"
	$labelLogOnTo.Location = '11, 268'
	$labelLogOnTo.Name = "labelLogOnTo"
	$labelLogOnTo.Size = '145, 18'
	$labelLogOnTo.TabIndex = 72
	$labelLogOnTo.Text = "Log On To..."
	#
	# UAADlnklblEditLogOnTo
	#
	$UAADlnklblEditLogOnTo.Location = '252, 262'
	$UAADlnklblEditLogOnTo.Name = "UAADlnklblEditLogOnTo"
	$UAADlnklblEditLogOnTo.Size = '38, 23'
	$UAADlnklblEditLogOnTo.TabIndex = 74
	$UAADlnklblEditLogOnTo.TabStop = $True
	$UAADlnklblEditLogOnTo.Text = "Edit"
	$UAADlnklblEditLogOnTo.TextAlign = 'MiddleCenter'
	$UAADlnklblEditLogOnTo.add_LinkClicked($UAADlnklblEditLogOnTo_LinkClicked)
	#
	# UAADLnklblSecMirror
	#
	$UAADLnklblSecMirror.Location = '486, 63'
	$UAADLnklblSecMirror.Name = "UAADLnklblSecMirror"
	$UAADLnklblSecMirror.Size = '37, 23'
	$UAADLnklblSecMirror.TabIndex = 80
	$UAADLnklblSecMirror.TabStop = $True
	$UAADLnklblSecMirror.Text = "Mirror"
	$UAADLnklblSecMirror.TextAlign = 'MiddleCenter'
	$UAADLnklblSecMirror.add_LinkClicked($UAADLnklblSecMirror_LinkClicked)
	#
	# UAADLnklblSecRemove
	#
	$UAADLnklblSecRemove.Location = '426, 63'
	$UAADLnklblSecRemove.Name = "UAADLnklblSecRemove"
	$UAADLnklblSecRemove.Size = '61, 23'
	$UAADLnklblSecRemove.TabIndex = 82
	$UAADLnklblSecRemove.TabStop = $True
	$UAADLnklblSecRemove.Text = "Remove"
	$UAADLnklblSecRemove.TextAlign = 'MiddleCenter'
	$UAADLnklblSecRemove.add_LinkClicked($UAADLnklblSecRemove_LinkClicked)
	#
	# UAADLnklblSecAdd
	#
	$UAADLnklblSecAdd.Location = '396, 63'
	$UAADLnklblSecAdd.Name = "UAADLnklblSecAdd"
	$UAADLnklblSecAdd.Size = '37, 23'
	$UAADLnklblSecAdd.TabIndex = 81
	$UAADLnklblSecAdd.TabStop = $True
	$UAADLnklblSecAdd.Text = "Add"
	$UAADLnklblSecAdd.TextAlign = 'MiddleCenter'
	$UAADLnklblSecAdd.add_LinkClicked($UAADLnklblSecAdd_LinkClicked)
	#
	# groupBox12
	#
	$groupBox12.Controls.Add($UAExchLnklblDelete)
	$groupBox12.Controls.Add($UAExchLvMessagingAddresses)
	$groupBox12.Controls.Add($UAExchLnklblAdd)
	$groupBox12.Controls.Add($UAExchGbStorageQuotas)
	$groupBox12.Controls.Add($UAExchTxtbxAlias)
	$groupBox12.Controls.Add($UAExchLblAlias)
	$groupBox12.Controls.Add($UAExchTxtbxDN)
	$groupBox12.Controls.Add($UAExchLblDisplayName)
	$groupBox12.Controls.Add($UAExchChkbxHideAddressBook)
	$groupBox12.Controls.Add($UAExchLblMessagingAddresses)
	$groupBox12.Controls.Add($UAExchCmbbxDatabase)
	$groupBox12.Controls.Add($UAExchlblDataBase)
	$groupBox12.Controls.Add($UAExchBtnCreateExchangeAccount)
	$groupBox12.Controls.Add($UAExchLnklblMakePrimary)
	$groupBox12.Controls.Add($UAExchLnklblRemove)
	$groupBox12.BackColor = 'Transparent'
	$groupBox12.Location = '543, 200'
	$groupBox12.Name = "groupBox12"
	$groupBox12.Size = '299, 362'
	$groupBox12.TabIndex = 52
	$groupBox12.TabStop = $False
	$groupBox12.Text = "Email (Exchange)"
	#
	# UAExchLnklblDelete
	#
	$UAExchLnklblDelete.BackColor = 'AppWorkspace'
	$UAExchLnklblDelete.Location = '218, -5'
	$UAExchLnklblDelete.Name = "UAExchLnklblDelete"
	$UAExchLnklblDelete.Size = '52, 23'
	$UAExchLnklblDelete.TabIndex = 87
	$UAExchLnklblDelete.TabStop = $True
	$UAExchLnklblDelete.Text = "Delete"
	$UAExchLnklblDelete.TextAlign = 'MiddleCenter'
	$UAExchLnklblDelete.add_LinkClicked($UAExchLnklblDelete_LinkClicked)
	#
	# UAExchLvMessagingAddresses
	#
	[void]$UAExchLvMessagingAddresses.Columns.Add($EmailAddresses)
	$UAExchLvMessagingAddresses.Location = '9, 227'
	$UAExchLvMessagingAddresses.Name = "UAExchLvMessagingAddresses"
	$UAExchLvMessagingAddresses.Size = '283, 125'
	$UAExchLvMessagingAddresses.TabIndex = 59
	$UAExchLvMessagingAddresses.UseCompatibleStateImageBehavior = $False
	$UAExchLvMessagingAddresses.View = 'Details'
	#
	# UAExchLnklblAdd
	#
	$UAExchLnklblAdd.Location = '129, 208'
	$UAExchLnklblAdd.Name = "UAExchLnklblAdd"
	$UAExchLnklblAdd.Size = '29, 23'
	$UAExchLnklblAdd.TabIndex = 83
	$UAExchLnklblAdd.TabStop = $True
	$UAExchLnklblAdd.Text = "Add"
	$UAExchLnklblAdd.TextAlign = 'MiddleCenter'
	$UAExchLnklblAdd.add_LinkClicked($UAExchLnklblAdd_LinkClicked)
	#
	# UAExchGbStorageQuotas
	#
	$UAExchGbStorageQuotas.Controls.Add($UAExchTxtbxMBProhibit)
	$UAExchGbStorageQuotas.Controls.Add($UAExchTxtbxMBWarning)
	$UAExchGbStorageQuotas.Controls.Add($UAExchChkbxUseMBDefaults)
	$UAExchGbStorageQuotas.Controls.Add($UAExchChkbxMBProhibit)
	$UAExchGbStorageQuotas.Controls.Add($UAExchChkbxMBWarning)
	$UAExchGbStorageQuotas.Location = '9, 124'
	$UAExchGbStorageQuotas.Name = "UAExchGbStorageQuotas"
	$UAExchGbStorageQuotas.Size = '283, 84'
	$UAExchGbStorageQuotas.TabIndex = 82
	$UAExchGbStorageQuotas.TabStop = $False
	$UAExchGbStorageQuotas.Text = "Storage Quotas"
	#
	# UAExchTxtbxMBProhibit
	#
	$UAExchTxtbxMBProhibit.Enabled = $False
	$UAExchTxtbxMBProhibit.Location = '186, 57'
	$UAExchTxtbxMBProhibit.Name = "UAExchTxtbxMBProhibit"
	$UAExchTxtbxMBProhibit.Size = '75, 20'
	$UAExchTxtbxMBProhibit.TabIndex = 87
	#
	# UAExchTxtbxMBWarning
	#
	$UAExchTxtbxMBWarning.Enabled = $False
	$UAExchTxtbxMBWarning.Location = '186, 34'
	$UAExchTxtbxMBWarning.Name = "UAExchTxtbxMBWarning"
	$UAExchTxtbxMBWarning.Size = '75, 20'
	$UAExchTxtbxMBWarning.TabIndex = 86
	#
	# UAExchChkbxUseMBDefaults
	#
	$UAExchChkbxUseMBDefaults.Location = '6, 16'
	$UAExchChkbxUseMBDefaults.Name = "UAExchChkbxUseMBDefaults"
	$UAExchChkbxUseMBDefaults.Size = '195, 16'
	$UAExchChkbxUseMBDefaults.TabIndex = 83
	$UAExchChkbxUseMBDefaults.Text = "Use Mailbox Database Defaults"
	$UAExchChkbxUseMBDefaults.UseVisualStyleBackColor = $True
	$UAExchChkbxUseMBDefaults.add_CheckedChanged($UAExchChkbxUseMBDefaults_CheckedChanged)
	#
	# UAExchChkbxMBProhibit
	#
	$UAExchChkbxMBProhibit.Location = '32, 56'
	$UAExchChkbxMBProhibit.Name = "UAExchChkbxMBProhibit"
	$UAExchChkbxMBProhibit.Size = '148, 22'
	$UAExchChkbxMBProhibit.TabIndex = 85
	$UAExchChkbxMBProhibit.Text = "Prohibit send at (MB):"
	$UAExchChkbxMBProhibit.UseVisualStyleBackColor = $True
	$UAExchChkbxMBProhibit.add_CheckedChanged($UAExchChkbxMBProhibit_CheckedChanged)
	#
	# UAExchChkbxMBWarning
	#
	$UAExchChkbxMBWarning.Location = '32, 35'
	$UAExchChkbxMBWarning.Name = "UAExchChkbxMBWarning"
	$UAExchChkbxMBWarning.Size = '148, 20'
	$UAExchChkbxMBWarning.TabIndex = 84
	$UAExchChkbxMBWarning.Text = "Issue warning at (MB):"
	$UAExchChkbxMBWarning.UseVisualStyleBackColor = $True
	$UAExchChkbxMBWarning.add_CheckedChanged($UAExchChkbxMBWarning_CheckedChanged)
	#
	# UAExchTxtbxAlias
	#
	$UAExchTxtbxAlias.Location = '112, 51'
	$UAExchTxtbxAlias.Name = "UAExchTxtbxAlias"
	$UAExchTxtbxAlias.Size = '177, 20'
	$UAExchTxtbxAlias.TabIndex = 80
	#
	# UAExchLblAlias
	#
	$UAExchLblAlias.AutoSize = $True
	$UAExchLblAlias.Location = '12, 54'
	$UAExchLblAlias.Name = "UAExchLblAlias"
	$UAExchLblAlias.Size = '32, 13'
	$UAExchLblAlias.TabIndex = 81
	$UAExchLblAlias.Text = "Alias:"
	#
	# UAExchTxtbxDN
	#
	$UAExchTxtbxDN.Location = '112, 24'
	$UAExchTxtbxDN.Name = "UAExchTxtbxDN"
	$UAExchTxtbxDN.Size = '177, 20'
	$UAExchTxtbxDN.TabIndex = 78
	#
	# UAExchLblDisplayName
	#
	$UAExchLblDisplayName.AutoSize = $True
	$UAExchLblDisplayName.Location = '12, 27'
	$UAExchLblDisplayName.Name = "UAExchLblDisplayName"
	$UAExchLblDisplayName.Size = '75, 13'
	$UAExchLblDisplayName.TabIndex = 79
	$UAExchLblDisplayName.Text = "Display Name:"
	#
	# UAExchChkbxHideAddressBook
	#
	$UAExchChkbxHideAddressBook.Location = '12, 99'
	$UAExchChkbxHideAddressBook.Name = "UAExchChkbxHideAddressBook"
	$UAExchChkbxHideAddressBook.Size = '169, 24'
	$UAExchChkbxHideAddressBook.TabIndex = 57
	$UAExchChkbxHideAddressBook.Text = "Hidden From Address Book"
	$UAExchChkbxHideAddressBook.UseVisualStyleBackColor = $True
	#
	# UAExchLblMessagingAddresses
	#
	$UAExchLblMessagingAddresses.BackColor = 'Transparent'
	$UAExchLblMessagingAddresses.Location = '8, 214'
	$UAExchLblMessagingAddresses.Name = "UAExchLblMessagingAddresses"
	$UAExchLblMessagingAddresses.Size = '135, 23'
	$UAExchLblMessagingAddresses.TabIndex = 56
	$UAExchLblMessagingAddresses.Text = "Messaging Addresses:"
	#
	# UAExchCmbbxDatabase
	#
	$UAExchCmbbxDatabase.FormattingEnabled = $True
	[void]$UAExchCmbbxDatabase.Items.Add("ATLEXCHDB01-MB01")
	[void]$UAExchCmbbxDatabase.Items.Add("ATLEXCHDB01-MB02")
	[void]$UAExchCmbbxDatabase.Items.Add("SGUEXCHDB01-MB01")
	[void]$UAExchCmbbxDatabase.Items.Add("SGUEXCHDB01-MB02")
	$UAExchCmbbxDatabase.Location = '112, 77'
	$UAExchCmbbxDatabase.Name = "UAExchCmbbxDatabase"
	$UAExchCmbbxDatabase.Size = '177, 21'
	$UAExchCmbbxDatabase.TabIndex = 55
	#
	# UAExchlblDataBase
	#
	$UAExchlblDataBase.AutoSize = $True
	$UAExchlblDataBase.Location = '12, 77'
	$UAExchlblDataBase.Name = "UAExchlblDataBase"
	$UAExchlblDataBase.Size = '56, 13'
	$UAExchlblDataBase.TabIndex = 54
	$UAExchlblDataBase.Text = "Database:"
	#
	# UAExchBtnCreateExchangeAccount
	#
	$UAExchBtnCreateExchangeAccount.Location = '12, 21'
	$UAExchBtnCreateExchangeAccount.Name = "UAExchBtnCreateExchangeAccount"
	$UAExchBtnCreateExchangeAccount.Size = '277, 23'
	$UAExchBtnCreateExchangeAccount.TabIndex = 84
	$UAExchBtnCreateExchangeAccount.Text = "Create Exchange Account"
	$UAExchBtnCreateExchangeAccount.UseVisualStyleBackColor = $True
	$UAExchBtnCreateExchangeAccount.Visible = $False
	$UAExchBtnCreateExchangeAccount.add_Click($UAExchBtnCreateExchangeAccount_Click)
	#
	# UAExchLnklblMakePrimary
	#
	$UAExchLnklblMakePrimary.BackColor = 'Transparent'
	$UAExchLnklblMakePrimary.Location = '215, 208'
	$UAExchLnklblMakePrimary.Name = "UAExchLnklblMakePrimary"
	$UAExchLnklblMakePrimary.Size = '81, 23'
	$UAExchLnklblMakePrimary.TabIndex = 86
	$UAExchLnklblMakePrimary.TabStop = $True
	$UAExchLnklblMakePrimary.Text = "Make Primary"
	$UAExchLnklblMakePrimary.TextAlign = 'MiddleCenter'
	$UAExchLnklblMakePrimary.add_LinkClicked($UAExchLnklblMakePrimary_LinkClicked)
	#
	# UAExchLnklblRemove
	#
	$UAExchLnklblRemove.BackColor = 'Transparent'
	$UAExchLnklblRemove.Location = '161, 208'
	$UAExchLnklblRemove.Name = "UAExchLnklblRemove"
	$UAExchLnklblRemove.Size = '56, 23'
	$UAExchLnklblRemove.TabIndex = 85
	$UAExchLnklblRemove.TabStop = $True
	$UAExchLnklblRemove.Text = "Remove"
	$UAExchLnklblRemove.TextAlign = 'MiddleCenter'
	$UAExchLnklblRemove.add_LinkClicked($UAExchLnklblRemove_LinkClicked)
	#
	# UAlblADStatus
	#
	$UAlblADStatus.AutoSize = $True
	$UAlblADStatus.Location = '549, 12'
	$UAlblADStatus.Name = "UAlblADStatus"
	$UAlblADStatus.Size = '58, 13'
	$UAlblADStatus.TabIndex = 49
	$UAlblADStatus.Text = "AD Status:"
	#
	# UAADCmbbxStatus
	#
	$UAADCmbbxStatus.FormattingEnabled = $True
	[void]$UAADCmbbxStatus.Items.Add("Default (No Change)")
	[void]$UAADCmbbxStatus.Items.Add("Delete User Account")
	[void]$UAADCmbbxStatus.Items.Add("Disable Account")
	[void]$UAADCmbbxStatus.Items.Add("Enable Account")
	[void]$UAADCmbbxStatus.Items.Add("Enable LOA")
	[void]$UAADCmbbxStatus.Items.Add("Disable LOA")
	$UAADCmbbxStatus.Location = '607, 8'
	$UAADCmbbxStatus.Name = "UAADCmbbxStatus"
	$UAADCmbbxStatus.Size = '115, 21'
	$UAADCmbbxStatus.TabIndex = 50
	#
	# menuFile
	#
	[void]$menuFile.DropDownItems.Add($menuFileConnect)
	[void]$menuFile.DropDownItems.Add($menuFileExit)
	$menuFile.Name = "menuFile"
	$menuFile.Size = '37, 20'
	$menuFile.Text = "File"
	#
	# helpToolStripMenuItem
	#
	[void]$helpToolStripMenuItem.DropDownItems.Add($aboutToolStripMenuItem)
	$helpToolStripMenuItem.Name = "helpToolStripMenuItem"
	$helpToolStripMenuItem.Size = '44, 20'
	$helpToolStripMenuItem.Text = "Help"
	#
	# notifyIcon1
	#
	$notifyIcon1.Text = "notifyIcon1"
	#
	# aboutToolStripMenuItem
	#
	$aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"
	$aboutToolStripMenuItem.Size = '107, 22'
	$aboutToolStripMenuItem.Text = "About"
	#
	# menuFileExit
	#
	$menuFileExit.Name = "menuFileExit"
	$menuFileExit.Size = '186, 22'
	$menuFileExit.Text = "Exit"
	$menuFileExit.add_Click($MenuFileExit_Click)
	#
	# menuView
	#
	[void]$menuView.DropDownItems.Add($menuViewEventVwr)
	[void]$menuView.DropDownItems.Add($menuViewServices)
	[void]$menuView.DropDownItems.Add($menuViewUser)
	[void]$menuView.DropDownItems.Add($menuViewWSUS)
	$menuView.Name = "menuView"
	$menuView.Size = '44, 20'
	$menuView.Text = "View"
	#
	# menuFileConnect
	#
	$menuFileConnect.Name = "menuFileConnect"
	$menuFileConnect.Size = '186, 22'
	$menuFileConnect.Text = "Connect to domain..."
	#
	# menuViewEventVwr
	#
	$menuViewEventVwr.Name = "menuViewEventVwr"
	$menuViewEventVwr.Size = '141, 22'
	$menuViewEventVwr.Text = "Event Viewer"
	#
	# menuViewServices
	#
	$menuViewServices.Name = "menuViewServices"
	$menuViewServices.Size = '141, 22'
	$menuViewServices.Text = "Services"
	#
	# menuViewUser
	#
	$menuViewUser.Name = "menuViewUser"
	$menuViewUser.Size = '141, 22'
	$menuViewUser.Text = "User"
	#
	# menuViewWSUS
	#
	[void]$menuViewWSUS.DropDownItems.Add($menuViewWSUSReport)
	[void]$menuViewWSUS.DropDownItems.Add($menuViewWSUSUpdate)
	$menuViewWSUS.Name = "menuViewWSUS"
	$menuViewWSUS.Size = '152, 22'
	$menuViewWSUS.Text = "WSUS"
	#
	# menuViewWSUSReport
	#
	$menuViewWSUSReport.Name = "menuViewWSUSReport"
	$menuViewWSUSReport.Size = '143, 22'
	$menuViewWSUSReport.Text = "WSUS Report"
	#
	# menuViewWSUSUpdate
	#
	$menuViewWSUSUpdate.Name = "menuViewWSUSUpdate"
	$menuViewWSUSUpdate.Size = '146, 22'
	$menuViewWSUSUpdate.Text = "WSUS Update"
	#
	# contextMenuCI
	#
	[void]$contextMenuCI.Items.Add($cmsProcEnd)
	[void]$contextMenuCI.Items.Add($cmsStartupRemove)
	[void]$contextMenuCI.Items.Add($cmsAdminAdd)
	[void]$contextMenuCI.Items.Add($cmsAdminRemove)
	[void]$contextMenuCI.Items.Add($cmsAppUninstall)
	[void]$contextMenuCI.Items.Add($cmsSelect)
	$contextMenuCI.Name = "contextMenuCI"
	$contextMenuCI.Size = '188, 114'
	#
	# cmsSelect
	#
	$cmsSelect.Name = "cmsSelect"
	$cmsSelect.Size = '187, 22'
	$cmsSelect.Text = "Select Computer"
	$cmsSelect.Visible = $False
	#
	# cmsStartupRemove
	#
	$cmsStartupRemove.Name = "cmsStartupRemove"
	$cmsStartupRemove.Size = '187, 22'
	$cmsStartupRemove.Text = "Remove Startup Item"
	$cmsStartupRemove.Visible = $False
	#
	# cmsAdminAdd
	#
	$cmsAdminAdd.Name = "cmsAdminAdd"
	$cmsAdminAdd.Size = '187, 22'
	$cmsAdminAdd.Text = "Add Local Admin"
	$cmsAdminAdd.Visible = $False
	#
	# cmsAdminRemove
	#
	$cmsAdminRemove.Name = "cmsAdminRemove"
	$cmsAdminRemove.Size = '187, 22'
	$cmsAdminRemove.Text = "Remove Local Admin"
	$cmsAdminRemove.Visible = $False
	#
	# cmsAppUninstall
	#
	$cmsAppUninstall.Name = "cmsAppUninstall"
	$cmsAppUninstall.Size = '187, 22'
	$cmsAppUninstall.Text = "cmsAppUninstall"
	$cmsAppUninstall.Visible = $False
	#
	# cmsProcEnd
	#
	$cmsProcEnd.Name = "cmsProcEnd"
	$cmsProcEnd.Size = '187, 22'
	$cmsProcEnd.Text = "End Process"
	$cmsProcEnd.Visible = $False
	#
	# tooltip1
	#
	$tooltip1.AutoPopDelay = 10000
	$tooltip1.InitialDelay = 250
	$tooltip1.ReshowDelay = 100
	#
	# miniToolStrip
	#
	$miniToolStrip.AutoSize = $False
	$miniToolStrip.Dock = 'None'
	$miniToolStrip.Location = '1, 1'
	$miniToolStrip.Name = "miniToolStrip"
	$miniToolStrip.Size = '839, 22'
	$miniToolStrip.TabIndex = 50
	#
	# labelEmpNoSAM
	#
	$labelEmpNoSAM.AutoSize = $True
	$labelEmpNoSAM.Location = '9, 18'
	$labelEmpNoSAM.Name = "labelEmpNoSAM"
	$labelEmpNoSAM.Size = '73, 13'
	$labelEmpNoSAM.TabIndex = 56
	$labelEmpNoSAM.Text = "EmpNo/SAM:"
	#
	# GroupName
	#
	$GroupName.Text = "GroupName"
	$GroupName.Width = 209
	#
	# ComputerName
	#
	$ComputerName.Text = "Computer Name"
	$ComputerName.Width = 257
	#
	# EmailAddresses
	#
	$EmailAddresses.Text = "Email Addresses"
	$EmailAddresses.Width = 274
	#endregion Generated Form Code

	#----------------------------------------------

	#Save the initial state of the form
	$InitialFormWindowState = $MainForm.WindowState
	#Init the OnLoad event to correct the initial state of the form
	$MainForm.add_Load($Form_StateCorrection_Load)
	#Clean up the control events
	$MainForm.add_FormClosed($Form_Cleanup_FormClosed)
	#Store the control values when form is closing
	$MainForm.add_Closing($Form_StoreValues_Closing)
	#Show the Form
	return $MainForm.ShowDialog()

}
#endregion Source: MainForm.pff

#region Source: Globals.ps1
	#--------------------------------------------
	# Declare Global Variables and Functions here
	#--------------------------------------------
	
	#region Main Form Global Variables
	
	#RichTextBox Font Defaults
	$Global:fontBold = new-object System.Drawing.Font("Calibri",8,[Drawing.FontStyle]'Bold' )
	$Global:fontHeader = new-object System.Drawing.Font("Calibri Light",10,[Drawing.FontStyle]'Bold' )
	$Global:fontNormal = new-object System.Drawing.Font("Calibri",8,[Drawing.FontStyle]'Regular')
	$Global:fontSmall = new-object System.Drawing.Font("Calibri Light",7,[Drawing.FontStyle]'Regular')
	$Global:fontItalic = new-object System.Drawing.Font("Calibri Light",8,[Drawing.FontStyle]'Italic')
	$Global:fontCode = new-object System.Drawing.Font("Lucida Console",8,[Drawing.FontStyle]'Bold')
	
	$ADServer = Read-Host -Prompt "Please enter your AD server"
	$ExchServer = Read-Host -Prompt "Please enter your Exchange server"
	$LyncServer = Read-Host -Prompt "Please enter your Lync server"
	
	$Global:PSAD = $ADServer
	$Global:PSExchServer = $ExchServer
	$Global:PSLync = $LyncServer
	#endregion Main Form Global Variables
	
	#region Global Functions
	function Get-ScriptDirectory{ 
		if($hostinvocation -ne $null)
		{
			Split-Path $hostinvocation.MyCommand.path
		}
		else
		{
			Split-Path $script:MyInvocation.MyCommand.Path
		}
	}
	#function OnApplicationExit{
	#	
	#}
	function ITMTAppend-RTB{
		Param(
			[System.Windows.Forms.RichTextBox]$RichTextBox,
			[System.Drawing.Font]$Font,
			[string]$Text,
			[switch]$Clear,
			[switch]$NewLine,
			[string]$Color
			
		)
		
		if($Clear)
		{
			$RichTextBox.Items.Clear();
		}
		
		elseif($NewLine){
			$RichTextBox.AppendText([char]10)	
		}
		elseif($Color){
			$RichTextBox.SelectionFont = $Font
			$RichTextBox.SelectionColor = $Color
			$RichTextBox.AppendText($Text)
		}
		else{
			$RichTextBox.SelectionFont = $Font
			$RichTextBox.SelectionColor = 'Black'
			$RichTextBox.AppendText($Text)
		}
	}
	function Compare-Hashtable([Hashtable]$ReferenceObject,[Hashtable]$DifferenceObject,[switch]$IncludeEqual){
	  # Creates a result object.
	  function result( [string]$side ) {
	    New-Object PSObject -Property @{
	      'InputPath'= "$path$key";
	      'SideIndicator' = $side;
	      'ReferenceValue' = $refValue;
	      'DifferenceValue' = $difValue;
	    }
	  }
	
	  # Recursively compares two hashtables.
	  function core( [string]$path, [Hashtable]$ref, [Hashtable]$dif ) {
	    # Hold on to keys from the other object that are not in the reference.
	    $nonrefKeys = New-Object 'System.Collections.Generic.HashSet[string]'
	    $dif.Keys | foreach { [void]$nonrefKeys.Add( $_ ) }
	
	    # Test each key in the reference with that in the other object.
	    foreach( $key in $ref.Keys ) {
	      [void]$nonrefKeys.Remove( $key )
	      $refValue = $ref.$key
	      $difValue = $dif.$key
	
	      if( -not $dif.ContainsKey( $key ) ) {
	        result '<='
	      }
	      elseif( $refValue -is [hashtable] -and $difValue -is [hashtable] ) {
	        core "$path$key." $refValue $difValue
	      }
	      elseif( $refValue -ne $difValue ) {
	        result '<>'
	      }
	      elseif( $IncludeEqual ) {
	        result '=='
	      }
	    }
	
	    # Show all keys in the other object not in the reference.
	    $refValue = $null
	    foreach( $key in $nonrefKeys ) {
	      $difValue = $dif.$key
	      result '=>'
	    }
	  }
	
	  core '' $ReferenceObject $DifferenceObject
	}
	#endregion Global Functions
	
	#region Remoting Engine
	# Todo: Set the ability to fire off and keep track of individual remoting sessions.
	function ITMTInvoke-AD{
		
	}
	
	function ITMTInvoke-Exchange{
		
	}
	
	function ITMTInvoke-Lync{
		
	}
	
	function ITMTCreate-RemoteSession{
	<#
		.SYNOPSIS
			Initialize Remote Powershell Session
	
		.DESCRIPTION
			Creates remote sessions to management servers
	
		.PARAMETER AD
			Creates an AD remote session
		
		.PARAMETER Exchange
			Creates an Exchange remote session
		
		.PARAMETER Lync
			Creates a Lync remote session
		
		.PARAMETER ALL
			Creates all available remote sessions
		
		.EXAMPLE
			ITMTCreate-RemoteSession 
	#>
		Param(
			[switch]$AD,
			[switch]$Exchange,
			[switch]$Lync,
			[switch]$All
		)
		
		if($AD){
			$Global:sAD = $(try {New-PSSession -ComputerName $Global:PSAD -Name 'PSRAD' -Authentication 'Credssp' -Credential $Global:c -ea 'Stop'}
			catch [Exception]{
				$string = ($_.Exception.Message+"`n`nMost likely however, you just entered the wrong username and password.")
				[System.Windows.Forms.MessageBox]::Show($string)
				return
			})
			Invoke-Command { Import-Module ActiveDirectory } -Session $Global:sAD
			Write-Host "Created AD Session: $Global:sAD"
		}
		if($Exchange){
			try{$Global:sExch = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $global:PSExchServer -Authentication Kerberos -Name 'PSRExchange'}
			catch [Exception]{
				[System.Windows.Forms.MessageBox]::Show($_.Exception.Message)
				Write-Host "Entered Exchange? WTF?"
				ITMTRemove-RemoteSession -All
				return
			}
			Write-Host "Created Exchange Session: $Global:sExch"
		}
		if($Lync){
			try{$Global:sLync = New-PSSession -ConnectionUri $Global:PSLync -Name 'PSRLync' -Authentication 'NegotiateWithImplicitCredential'}
			catch [Exception]{
				[System.Windows.Forms.MessageBox]::Show($_.Exception.Message)
				ITMTRemove-RemoteSession -All
				return
			}
			Write-Host "Created Lync Session: $Global:sLync"
		}
		if($All -or (-not $AD -and -not $Exchange -and -not $Lync)){
			
			try{$Global:sAD = New-PSSession -ComputerName $Global:PSADServer -Name 'PSRAD'-Authentication 'Credssp' -Credential $Global:c}
			catch [Exception]{
				[System.Windows.Forms.MessageBox]::Show($_.Exception.Message)
				return
			}
			Invoke-Command { Import-Module ActiveDirectory } -Session $Global:sAD
			
			try{$Global:sExch = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $global:PSExchServer -Authentication Kerberos -Name 'PSRExchange'}
			catch [Exception]{
				[System.Windows.Forms.MessageBox]::Show($_.Exception.Message)
				ITMTRemove-RemoteSession -AD
				return
			}
			
			try{$Global:sLync = New-PSSession -ConnectionUri $Global:PSLync -Name 'PSRLync' -Authentication 'NegotiateWithImplicitCredential'}
			catch [Exception]{
				[System.Windows.Forms.MessageBox]::Show($_.Exception.Message)
				ITMTRemove-RemoteSession -AD -Exchange
				return
			}
			
			if($global:sExch -and $global:sAD -and $global:sLync){
				Write-Host "Created All Remote Sessions"
			}
		}
		
	}
	
	function ITMTCheck-RemoteSession{
	<#
		.SYNOPSIS
			Checks current remote powershell sessions
	
		.DESCRIPTION
			Creates remote sessions to management servers
	
		.PARAMETER Exchange
			Checks for an Exchange remote session
		
		.PARAMETER Lync
			Checks for a Lync remote session
		
		.EXAMPLE
			ITMTCheck-RemoteSession 
	#>
		Param(
			[switch]$AD,
			[switch]$Exchange,
			[switch]$Lync,
			[switch]$All
		)
	}
	
	function ITMTRemove-RemoteSession{
		Param(
			[switch]$AD,
			[switch]$Exchange,
			[switch]$Lync,
			[switch]$All
		)
		if($AD){
			Write-Host "AD Session Cleaned"
			Remove-PSSession $Global:sAD
		}
		if($Exchange){
			Write-Host "Exchange Session Cleaned"
			Remove-PSSession $Global:sExch
		}
		if($Lync){
			Write-Host "Lync Session Cleaned"
			Remove-PSSession $Global:sLync
		}
		if($All -or (-not $AD -and -not $Exchange -and -not $Lync)){
			try{Remove-PSSession $Global:sAD}
			catch [Exception]{
				[System.Windows.Forms.MessageBox]::Show($_.Exception.Message)
				return
			}
			try{Remove-PSSession $Global:sExch}
			catch [Exception]{
				[System.Windows.Forms.MessageBox]::Show($_.Exception.Message)
				return
			}
			try{Remove-PSSession $Global:sLync}
			catch [Exception]{
				[System.Windows.Forms.MessageBox]::Show($_.Exception.Message)
				return
			}
			Write-Host "ALL Sessions Cleaned"
		}
	}
	
	#endregion Remoting Engine
	
	#Sample variable that provides the location of the script
	[string]$ScriptDirectory = Get-ScriptDirectory
	
	
	
	
#endregion Source: Globals.ps1

#region Source: Ping.pff
function Call-Ping_pff
{
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
7yIAAB+LCAAAAAAABADtWl9v2zYQfx+w70DoqQVc27L8d3AEJE47BE1XI/bavRW0dLa5UKJGUY69
T7+jJDuW5dS0G2cZsARIpOMd73j30/GOUv8OPLEAubqmiro//0RI/7NkMxZS/oFx+I0G4A5ZOKtG
02m/VhpKBfTdF5AxE6FrVxv92jYhm3LyJ3iKqFUEF9ZoFSsIql9Z6IuHuPpByCD7WyH7hiokn+qi
Wa3r3woZJFwlEi5CSJSkvEKGyYQz7yOsxuIewotJp0NbXqtt95wm1Ls9i4Ro7IU1xfn0YizizRn3
JbJaAxEqKXhspZairUMpIpBqlcsMOINQjdjfYLlOt1UhnWa/tuZ5QkbbfSWkD3KkVhwFP7Al+CPU
zOGgsPar5a5NPcg+UlSqoYiZQhdZ7gCNBTmkuDZ1UHYMS2W5+9W8X+AMOd+toD4uAk1Kqd/0fb+W
Xq/ZD0dYK7sSy7MHWS3VZ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7jj8HX/nchExhz5zLNFqHJbC5nouHRyU7AkXnXWI1HuDiIF7P
llNWbu6sTzSkMwiwwatq+4MUpI9Oc0yd5tiTqdNttanvtJvg4Oaz0bRf8zME5qCOZ4fCYY3Xkj7g
XnqKrrozbU07U9v2W3Xq0O/oCmJPSM4mL7MiquiLKPoj4C+zIGwkPSXkagRywTw4CRjfD9bmdv3k
9YfUu8cHTa6N+hVCwIm38mbGsHmNn6XFvdSceOPl7/MLrEUqPt5sinXwQEL6ZOuDgxJtwz1IYkwB
6/GtuZ8aGHKqdG/vvtMHEuubzfBdEo7Gl7pNzK8eBcUDyNEcOF9/mKB3qxJxvTsUvdUfgZdIhimx
tqYUBUofQaRRLX8Isc6vfuKpEvMOfZd/N1D7qNiBeJJFRSfX9lIH2HDScLXt813KQEQrqQ9iC0wl
2o3ugUPKdwzcT977BUm+Iz85hJYFjyeCua3B9hlh4WuT2hb2EQnbH7j8Aw4PvTLvIgAA#>
#endregion
param (
	[string]$Source,
	[string]$Destination
)

	#----------------------------------------------
	#region Import the Assemblies
	#----------------------------------------------
	[void][reflection.assembly]::Load("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	#endregion Import Assemblies

	#----------------------------------------------
	#region Generated Form Objects
	#----------------------------------------------
	[System.Windows.Forms.Application]::EnableVisualStyles()
	$formPing = New-Object 'System.Windows.Forms.Form'
	$txtbxPingDelay = New-Object 'System.Windows.Forms.TextBox'
	$txtbxPingTTL = New-Object 'System.Windows.Forms.TextBox'
	$labelTTLs = New-Object 'System.Windows.Forms.Label'
	$txtbxPingCount = New-Object 'System.Windows.Forms.TextBox'
	$btnPing = New-Object 'System.Windows.Forms.Button'
	$txtbxPingDestination = New-Object 'System.Windows.Forms.TextBox'
	$txtbxPingSource = New-Object 'System.Windows.Forms.TextBox'
	$lblPingDestination = New-Object 'System.Windows.Forms.Label'
	$lblPingSource = New-Object 'System.Windows.Forms.Label'
	$labelCount = New-Object 'System.Windows.Forms.Label'
	$labelDelays = New-Object 'System.Windows.Forms.Label'
	$tooltip1 = New-Object 'System.Windows.Forms.ToolTip'
	$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
	#endregion Generated Form Objects

	#----------------------------------------------
	# User Generated Script
	#----------------------------------------------
	
	
	
	$FormEvent_Load={
		$txtbxPingSource.Text = $Source
		$txtbxPingDestination.Text = $Destination
	}
	
	$btnPing_Click={
		$formPing.Close()
	}
	
	#region Process other Key Presses "Enter", "Esc" ###
	$formPing.KeyPreview = $True
	$formPing.Add_KeyDown({
		if($_.KeyCode -eq "Enter"){
			$btnPing.PerformClick()
		}
	})
	$formPing.Add_KeyDown({
		if($_.KeyCode -eq "Escape"){
			clear	
			$formPing.Close()
		}
	})
	
	
	# --End User Generated Script--
	#----------------------------------------------
	#region Generated Events
	#----------------------------------------------
	
	$Form_StateCorrection_Load=
	{
		#Correct the initial state of the form to prevent the .Net maximized form issue
		$formPing.WindowState = $InitialFormWindowState
	}
	
	$Form_StoreValues_Closing=
	{
		#Store the control values
		$script:Ping_txtbxPingDelay = $txtbxPingDelay.Text
		$script:Ping_txtbxPingTTL = $txtbxPingTTL.Text
		$script:Ping_txtbxPingCount = $txtbxPingCount.Text
		$script:Ping_txtbxPingDestination = $txtbxPingDestination.Text
		$script:Ping_txtbxPingSource = $txtbxPingSource.Text
	}

	
	$Form_Cleanup_FormClosed=
	{
		#Remove all event handlers from the controls
		try
		{
			$btnPing.remove_Click($btnPing_Click)
			$formPing.remove_Load($FormEvent_Load)
			$formPing.remove_Load($Form_StateCorrection_Load)
			$formPing.remove_Closing($Form_StoreValues_Closing)
			$formPing.remove_FormClosed($Form_Cleanup_FormClosed)
		}
		catch [Exception]
		{ }
	}
	#endregion Generated Events

	#----------------------------------------------
	#region Generated Form Code
	#----------------------------------------------
	#
	# formPing
	#
	$formPing.Controls.Add($txtbxPingDelay)
	$formPing.Controls.Add($txtbxPingTTL)
	$formPing.Controls.Add($labelTTLs)
	$formPing.Controls.Add($txtbxPingCount)
	$formPing.Controls.Add($btnPing)
	$formPing.Controls.Add($txtbxPingDestination)
	$formPing.Controls.Add($txtbxPingSource)
	$formPing.Controls.Add($lblPingDestination)
	$formPing.Controls.Add($lblPingSource)
	$formPing.Controls.Add($labelCount)
	$formPing.Controls.Add($labelDelays)
	$formPing.ClientSize = '385, 74'
	$formPing.FormBorderStyle = 'FixedSingle'
	$formPing.Name = "formPing"
	$formPing.StartPosition = 'CenterParent'
	$formPing.Text = "Ping"
	$formPing.add_Load($FormEvent_Load)
	#
	# txtbxPingDelay
	#
	$txtbxPingDelay.Location = '232, 41'
	$txtbxPingDelay.Name = "txtbxPingDelay"
	$txtbxPingDelay.Size = '30, 20'
	$txtbxPingDelay.TabIndex = 10
	$txtbxPingDelay.Text = "1"
	$tooltip1.SetToolTip($txtbxPingDelay, "Specifies the maximum time, in seconds, that each echo request packet (""pings"") is active. Enter an integer between 1 and 255. The default value is 80 (seconds). ")
	#
	# txtbxPingTTL
	#
	$txtbxPingTTL.Location = '139, 41'
	$txtbxPingTTL.Name = "txtbxPingTTL"
	$txtbxPingTTL.Size = '30, 20'
	$txtbxPingTTL.TabIndex = 8
	$txtbxPingTTL.Text = "80"
	$tooltip1.SetToolTip($txtbxPingTTL, "Specifies the maximum time, in seconds, that each echo request packet (""pings"") is active. Enter an integer between 1 and 255. The default value is 80 (seconds). ")
	#
	# labelTTLs
	#
	$labelTTLs.Location = '92, 40'
	$labelTTLs.Name = "labelTTLs"
	$labelTTLs.Size = '67, 23'
	$labelTTLs.TabIndex = 7
	$labelTTLs.Text = "TTL (s):"
	$labelTTLs.TextAlign = 'MiddleLeft'
	#
	# txtbxPingCount
	#
	$txtbxPingCount.Location = '57, 41'
	$txtbxPingCount.Name = "txtbxPingCount"
	$txtbxPingCount.Size = '30, 20'
	$txtbxPingCount.TabIndex = 5
	$txtbxPingCount.Text = "4"
	$tooltip1.SetToolTip($txtbxPingCount, "Specifies the number of echo requests to send. The default value is 4.")
	#
	# btnPing
	#
	$btnPing.Anchor = 'Bottom, Right'
	$btnPing.DialogResult = 'OK'
	$btnPing.Location = '283, 39'
	$btnPing.Name = "btnPing"
	$btnPing.Size = '90, 23'
	$btnPing.TabIndex = 4
	$btnPing.Text = "Ping"
	$tooltip1.SetToolTip($btnPing, "Executes the Ping.")
	$btnPing.UseVisualStyleBackColor = $True
	$btnPing.add_Click($btnPing_Click)
	#
	# txtbxPingDestination
	#
	$txtbxPingDestination.Location = '248, 12'
	$txtbxPingDestination.Name = "txtbxPingDestination"
	$txtbxPingDestination.Size = '125, 20'
	$txtbxPingDestination.TabIndex = 1
	$tooltip1.SetToolTip($txtbxPingDestination, "Specifies the computers to ping. Type the computer names or type IP addresses in IPv4 or IPv6 format. Wildcard characters are not permitted. This parameter is required.")
	#
	# txtbxPingSource
	#
	$txtbxPingSource.Location = '64, 12'
	$txtbxPingSource.Name = "txtbxPingSource"
	$txtbxPingSource.Size = '115, 20'
	$txtbxPingSource.TabIndex = 0
	$tooltip1.SetToolTip($txtbxPingSource, "Specifies the names of the computers where the ping originates. Enter a comma-separated list of computer names. The default is the local computer.")
	#
	# lblPingDestination
	#
	$lblPingDestination.Location = '185, 15'
	$lblPingDestination.Name = "lblPingDestination"
	$lblPingDestination.Size = '73, 23'
	$lblPingDestination.TabIndex = 3
	$lblPingDestination.Text = "Destination:"
	#
	# lblPingSource
	#
	$lblPingSource.Location = '17, 15'
	$lblPingSource.Name = "lblPingSource"
	$lblPingSource.Size = '63, 19'
	$lblPingSource.TabIndex = 2
	$lblPingSource.Text = "Source:"
	#
	# labelCount
	#
	$labelCount.Location = '17, 40'
	$labelCount.Name = "labelCount"
	$labelCount.Size = '41, 23'
	$labelCount.TabIndex = 6
	$labelCount.Text = "Count:"
	$labelCount.TextAlign = 'MiddleLeft'
	#
	# labelDelays
	#
	$labelDelays.Location = '179, 39'
	$labelDelays.Name = "labelDelays"
	$labelDelays.Size = '67, 23'
	$labelDelays.TabIndex = 9
	$labelDelays.Text = "Delay (s):"
	$labelDelays.TextAlign = 'MiddleLeft'
	#
	# tooltip1
	#
	$tooltip1.AutoPopDelay = 10000
	$tooltip1.InitialDelay = 250
	$tooltip1.ReshowDelay = 100
	#endregion Generated Form Code

	#----------------------------------------------

	#Save the initial state of the form
	$InitialFormWindowState = $formPing.WindowState
	#Init the OnLoad event to correct the initial state of the form
	$formPing.add_Load($Form_StateCorrection_Load)
	#Clean up the control events
	$formPing.add_FormClosed($Form_Cleanup_FormClosed)
	#Store the control values when form is closing
	$formPing.add_Closing($Form_StoreValues_Closing)
	#Show the Form
	return $formPing.ShowDialog()

}
#endregion Source: Ping.pff

#region Source: Search.pff
function Call-Search_pff
{
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
rTUAAB+LCAAAAAAABADtW1tv6roSft/S+Q8RD+eJXQghbTmHIkEo9ErLLRRelpzEgIsTIyehzfr1
286FhlubQFm7ldqqFXE8nvF8M5/HDil3oE4WkHp14IDKf/4ShPIDRRNkAdxAGLaACStdCKg+PZmP
x+Xcxk1fhF+pkNqIWBXxpFDOxRuCQbVnqDuC483hRabr2Q40TwbIMsiLfdIg1Az+Z4Vtt7JCONRF
8STPf7OC4mLHpfDCgq5DAc4Kj66GkX4LvR6ZQetCOzsDsi6fiiWpCPPnpYxgM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6AxtB2FQp9CKmI5
t9G27B2QYnQ/NvauG48YOPwti8rf/NFtdLG83XGtbq9ayZdz4ac3QfICaXfKisPopRpO3RuNEZOu
eqvchbpLEePlXNSyKiCsv8Djh8/mSzwRyRuu7mx0Xmtf778O1LbWqHJfkc9tbVWIOQeWF/f5eotC
5h7lxeRKp422a/7KigXwmoHbm7e+/RSuXjtvMcvMt1IptNWMF08rb0rlYrHPIiH+etY/EGuU9a01
AAA=#>
#endregion
	#----------------------------------------------
	#region Import the Assemblies
	#----------------------------------------------
	[void][reflection.assembly]::Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	#endregion Import Assemblies

	#----------------------------------------------
	#region Generated Form Objects
	#----------------------------------------------
	[System.Windows.Forms.Application]::EnableVisualStyles()
	$formEmployeeSearch = New-Object 'System.Windows.Forms.Form'
	$SearchResult = New-Object 'System.Windows.Forms.TextBox'
	$tbDepartment = New-Object 'System.Windows.Forms.TextBox'
	$tbLocation = New-Object 'System.Windows.Forms.TextBox'
	$tbLastName = New-Object 'System.Windows.Forms.TextBox'
	$tbEmployeeID = New-Object 'System.Windows.Forms.TextBox'
	$tbFirstName = New-Object 'System.Windows.Forms.TextBox'
	$labelDepartment = New-Object 'System.Windows.Forms.Label'
	$labelEmployeeID = New-Object 'System.Windows.Forms.Label'
	$labelLocation = New-Object 'System.Windows.Forms.Label'
	$labelDisplayName = New-Object 'System.Windows.Forms.Label'
	$labelLastName = New-Object 'System.Windows.Forms.Label'
	$labelFirstName = New-Object 'System.Windows.Forms.Label'
	$tbDisplayName = New-Object 'System.Windows.Forms.TextBox'
	$btnSearch = New-Object 'System.Windows.Forms.Button'
	$datagridviewResults = New-Object 'System.Windows.Forms.DataGridView'
	$btnSelect = New-Object 'System.Windows.Forms.Button'
	$buttonCustomQuery = New-Object 'System.Windows.Forms.Button'
	$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
	#endregion Generated Form Objects

	#----------------------------------------------
	# User Generated Script
	#----------------------------------------------
	$datagridviewResults.Visible = $false
	function OnApplicationLoad {
		#Note: This function is not called in Projects
		#Note: This function runs before the form is created
		#Note: To get the script directory in the Packager use: Split-Path $hostinvocation.MyCommand.path
		#Note: To get the console output in the Packager (Windows Mode) use: $ConsoleOutput (Type: System.Collections.ArrayList)
		#Important: Form controls cannot be accessed in this function
		#TODO: Add snapins and custom code to validate the application load
		return $true #return true for success or false for failure
	}
	function OnApplicationExit {
		#Note: This function is not called in Projects
		#Note: This function runs after the form is closed
		#TODO: Add custom code to clean up and unload snapins when the application exits
		
		$script:ExitCode = 0 #Set the exit code for the Packager
	}
	#region Search Function
	function SearchGrid()
	{
		$RowIndex = 0
		$ColumnIndex = 0
		$seachString = $tbDisplayName.Text
		
		if($seachString -eq "")
		{
			return
		}
		
		if($datagridviewResults.SelectedCells.Count -ne 0)
		{
			$startCell = $datagridviewResults.SelectedCells[0];
			$RowIndex = $startCell.RowIndex
			$ColumnIndex = $startCell.ColumnIndex + 1
		}
		
		$columnCount = $datagridviewResults.ColumnCount
		$rowCount = $datagridviewResults.RowCount
		for(;$RowIndex -lt $rowCount; $RowIndex++)
		{
			$Row = $datagridviewResults.Rows[$RowIndex]
			
			for(;$ColumnIndex -lt $columnCount; $ColumnIndex++)
			{
				$cell = $Row.Cells[$ColumnIndex]
				
				if($cell.Value.ToString().IndexOf($seachString, [StringComparison]::OrdinalIgnoreCase) -ne -1)
				{
					$datagridviewResults.CurrentCell = $cell
					return
				}
			}
			
			$ColumnIndex = 0
		}
		
		$datagridviewResults.CurrentCell = $null
		[void][System.Windows.Forms.MessageBox]::Show("The search has reached the end of the grid.","String not Found")
		
	}
	#endregion
	function PopulateGrid {
		param($Data)
	}
	function LDAPQuery {
	
		$datagridviewResults.Visible = $false
		
		$DT = New-Object System.Data.DataTable
		
		#Get Data from text boxes and format into LDAP friendly format
		if($tbDisplayName.Text -ne ""){$DisplayName = "*"+$tbDisplayName.Text+"*"}else{$DisplayName = "*"}
		if($tbEmployeeID.Text -ne ""){$EmployeeID = "*"+$tbEmployeeID.Text+"*"}else{$EmployeeID = "*"}
		if($tbFirstName.Text -ne ""){$FirstName = "*"+$tbFirstName.Text+"*"}else{$FirstName = "*"}
		if($tbLastName.Text -ne ""){$LastName = "*"+$tbLastName.Text+"*"}else{$LastName = "*"}
		if($tbLocation.Text -ne ""){$Location = "*"+$tbLocation.Text+"*"}else{$Location = "*"}
		if($tbDepartment.Text -ne ""){$Department = "*"+$tbDepartment.Text+"*"}else{$Department = "*"}
		
		#Compile LDAP search filter
		$strFilter = "(&(&(&(&(&(&(objectCategory=User)(displayName=$DisplayName))(employeeID=$EmployeeID))(givenName=$FirstName))(sn=$LastName))(physicalDeliveryOfficeName=$Location))(department=$Department))"
		
		#Get Domain in DN format
		$objDomain = New-Object System.DirectoryServices.DirectoryEntry 
		
		#Populate LDAP Searcher
		$objSearcher = New-Object System.DirectoryServices.DirectorySearcher #Create LDAP Searcher Object
		$objSearcher.SearchRoot = $objDomain #Search for this DN. If left $objDomain, it'll search from the domain root
		$objSearcher.PageSize = 1000 #Can be adjusted to limit results
		$objSearcher.Filter = $strFilter
		$objSearcher.SearchScope = "Subtree"
		
		#These are the LDAP properties that will be displayed and are tied to the column names in the GridView
		$colProplist = "DisplayName", "Title", "EmployeeID", "SAMAccountName", "physicalDeliveryOfficeName", "DistinguishedName"
		
		#Creating the column names in the gridview with the properties in the $colPropList. The column names can be 
		# different than the items in the property list. We just left them the same for convenience.
		foreach($item in $colProplist){
			$col = New-Object System.Data.DataColumn
			if($item -eq "physicalDeliveryOfficeName"){$item = "Office"}
			$col.ColumnName = $item
			$DT.Columns.Add($col)
		}
	
		#This is where we add the LDAP properties we want to retrieve from the query. In this case, we're using the
		# string variable $colProplist and looping through to add them one by one
		foreach ($i in $colPropList) {
			$objSearcher.PropertiesToLoad.Add("$i") > $null
		}
		
		#Execute the search and dump the results into the $colResults variable
		$colResults = $objSearcher.FindAll()
		
		#Populate DataGrid
		if($colResults.count -ne 0){
			#Loop through each
			foreach ($objResult in $colResults) {
				$col1 = $objResult.Properties.Item("displayName")
				$col2 = $objResult.Properties.Item("title")
				$col3 = $objResult.Properties.Item("employeeid")
				$col4 = $objResult.Properties.Item("SAMAccountName")
				$col5 = $objResult.Properties.Item("PhysicalDeliveryOfficeName")
				$col6 = $objResult.Properties.Item("DistinguishedName")
				$r = $DT.NewRow()
				$r["DisplayName"] = "$col1"
				$r["Title"] = "$col2"
				$r["EmployeeID"] = "$col3"
				$r["SAMAccountName"] = "$col4"
				$r["Office"] = "$col5"
				$r["DistinguishedName"] = "$col6"
				$DT.Rows.Add($r)
			}
			
			$datagridviewResults.DataSource = $DT
			$datagridviewResults.SelectionMode = 'FullRowSelect'
			$datagridviewResults.RowHeadersVisible = $false
			$datagridviewResults.Visible = $true
		}
		else{
			[System.Windows.Forms.MessageBox]::Show("No Results Found")	
		}
		#DataGridViewCellBorderStyle
		#http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewadvancedborderstyle.aspx
	
		
	}
	$FormEvent_Load={
		#TODO: Initialize Form Controls here
		
	}
	$btnSelect_Click={
		#TODO: Place custom script here
		#Call-MainForm_pff -result $datagridviewResults.SelectedRows[0].Cells[3].Value
		$SearchResult.Text = $datagridviewResults.SelectedRows[0].Cells[3].Value
		$formEmployeeSearch.Close()
	}
	$buttonCustomQuery_Click={
		#TODO: Place custom script here
	
	}
	$btnSearch_Click={
		#TODO: Place custom script here
		#SearchGrid
		LDAPQuery
	}
	#region Process other Key Presses "Enter", "Esc" ###
	$formEmployeeSearch.KeyPreview = $True
	$formEmployeeSearch.Add_KeyDown({
		if($_.KeyCode -eq "Enter"){
			if($tbDepartment.get_Focused() -or $tbDisplayName.get_Focused() -or $tbEmployeeID.get_Focused() -or $tbFirstName.get_Focused() -or $tbLastName.get_Focused -or $tbLocation.get_Focused){$btnSearch.PerformClick()}
			elseif($datagridviewResults.get_Focused()){$btnSelect.PerformClick()}
		}
	
	})
	$formEmployeeSearch.Add_KeyDown({
		if($_.KeyCode -eq "Escape"){
			clear	
			$formEmployeeSearch.Close()
		}
	})
	$datagridviewResults_CellMouseDoubleClick=[System.Windows.Forms.DataGridViewCellMouseEventHandler]{
	#Event Argument: $_ = [System.Windows.Forms.DataGridViewCellMouseEventArgs]
		$btnSelect.PerformClick()
	}	# --End User Generated Script--
	#----------------------------------------------
	#region Generated Events
	#----------------------------------------------
	
	$Form_StateCorrection_Load=
	{
		#Correct the initial state of the form to prevent the .Net maximized form issue
		$formEmployeeSearch.WindowState = $InitialFormWindowState
	}
	
	$Form_StoreValues_Closing=
	{
		#Store the control values
		$script:Search_SearchResult = $SearchResult.Text
		$script:Search_tbDepartment = $tbDepartment.Text
		$script:Search_tbLocation = $tbLocation.Text
		$script:Search_tbLastName = $tbLastName.Text
		$script:Search_tbEmployeeID = $tbEmployeeID.Text
		$script:Search_tbFirstName = $tbFirstName.Text
		$script:Search_tbDisplayName = $tbDisplayName.Text
	}

	
	$Form_Cleanup_FormClosed=
	{
		#Remove all event handlers from the controls
		try
		{
			$btnSearch.remove_Click($btnSearch_Click)
			$datagridviewResults.remove_CellMouseDoubleClick($datagridviewResults_CellMouseDoubleClick)
			$btnSelect.remove_Click($btnSelect_Click)
			$formEmployeeSearch.remove_Load($FormEvent_Load)
			$formEmployeeSearch.remove_Load($Form_StateCorrection_Load)
			$formEmployeeSearch.remove_Closing($Form_StoreValues_Closing)
			$formEmployeeSearch.remove_FormClosed($Form_Cleanup_FormClosed)
		}
		catch [Exception]
		{ }
	}
	#endregion Generated Events

	#----------------------------------------------
	#region Generated Form Code
	#----------------------------------------------
	#
	# formEmployeeSearch
	#
	$formEmployeeSearch.Controls.Add($SearchResult)
	$formEmployeeSearch.Controls.Add($tbDepartment)
	$formEmployeeSearch.Controls.Add($tbLocation)
	$formEmployeeSearch.Controls.Add($tbLastName)
	$formEmployeeSearch.Controls.Add($tbEmployeeID)
	$formEmployeeSearch.Controls.Add($tbFirstName)
	$formEmployeeSearch.Controls.Add($labelDepartment)
	$formEmployeeSearch.Controls.Add($labelEmployeeID)
	$formEmployeeSearch.Controls.Add($labelLocation)
	$formEmployeeSearch.Controls.Add($labelDisplayName)
	$formEmployeeSearch.Controls.Add($labelLastName)
	$formEmployeeSearch.Controls.Add($labelFirstName)
	$formEmployeeSearch.Controls.Add($tbDisplayName)
	$formEmployeeSearch.Controls.Add($btnSearch)
	$formEmployeeSearch.Controls.Add($datagridviewResults)
	$formEmployeeSearch.Controls.Add($btnSelect)
	$formEmployeeSearch.Controls.Add($buttonCustomQuery)
	$formEmployeeSearch.ClientSize = '541, 361'
	$formEmployeeSearch.FormBorderStyle = 'FixedDialog'
	$formEmployeeSearch.MaximizeBox = $False
	$formEmployeeSearch.MinimizeBox = $False
	$formEmployeeSearch.Name = "formEmployeeSearch"
	$formEmployeeSearch.StartPosition = 'CenterScreen'
	$formEmployeeSearch.Text = "Employee Search"
	$formEmployeeSearch.add_Load($FormEvent_Load)
	#
	# SearchResult
	#
	$SearchResult.Location = '110, 337'
	$SearchResult.Name = "SearchResult"
	$SearchResult.Size = '100, 20'
	$SearchResult.TabIndex = 32
	$SearchResult.Visible = $False
	#
	# tbDepartment
	#
	$tbDepartment.Location = '316, 67'
	$tbDepartment.Name = "tbDepartment"
	$tbDepartment.Size = '139, 20'
	$tbDepartment.TabIndex = 21
	#
	# tbLocation
	#
	$tbLocation.Location = '88, 67'
	$tbLocation.Name = "tbLocation"
	$tbLocation.Size = '139, 20'
	$tbLocation.TabIndex = 20
	#
	# tbLastName
	#
	$tbLastName.Location = '316, 38'
	$tbLastName.Name = "tbLastName"
	$tbLastName.Size = '139, 20'
	$tbLastName.TabIndex = 19
	#
	# tbEmployeeID
	#
	$tbEmployeeID.Location = '316, 6'
	$tbEmployeeID.Name = "tbEmployeeID"
	$tbEmployeeID.Size = '139, 20'
	$tbEmployeeID.TabIndex = 17
	#
	# tbFirstName
	#
	$tbFirstName.Location = '88, 38'
	$tbFirstName.Name = "tbFirstName"
	$tbFirstName.Size = '139, 20'
	$tbFirstName.TabIndex = 18
	#
	# labelDepartment
	#
	$labelDepartment.Location = '245, 70'
	$labelDepartment.Name = "labelDepartment"
	$labelDepartment.Size = '74, 23'
	$labelDepartment.TabIndex = 31
	$labelDepartment.Text = "Department:"
	#
	# labelEmployeeID
	#
	$labelEmployeeID.Location = '245, 9'
	$labelEmployeeID.Name = "labelEmployeeID"
	$labelEmployeeID.Size = '74, 23'
	$labelEmployeeID.TabIndex = 27
	$labelEmployeeID.Text = "Employee ID:"
	#
	# labelLocation
	#
	$labelLocation.Location = '3, 70'
	$labelLocation.Name = "labelLocation"
	$labelLocation.Size = '88, 23'
	$labelLocation.TabIndex = 30
	$labelLocation.Text = "Location:"
	#
	# labelDisplayName
	#
	$labelDisplayName.Location = '3, 9'
	$labelDisplayName.Name = "labelDisplayName"
	$labelDisplayName.Size = '85, 23'
	$labelDisplayName.TabIndex = 26
	$labelDisplayName.Text = "Display Name:"
	#
	# labelLastName
	#
	$labelLastName.Location = '245, 41'
	$labelLastName.Name = "labelLastName"
	$labelLastName.Size = '74, 23'
	$labelLastName.TabIndex = 29
	$labelLastName.Text = "Last Name:"
	#
	# labelFirstName
	#
	$labelFirstName.Location = '3, 41'
	$labelFirstName.Name = "labelFirstName"
	$labelFirstName.Size = '88, 23'
	$labelFirstName.TabIndex = 28
	$labelFirstName.Text = "First Name"
	#
	# tbDisplayName
	#
	$tbDisplayName.Location = '88, 6'
	$tbDisplayName.Name = "tbDisplayName"
	$tbDisplayName.Size = '139, 20'
	$tbDisplayName.TabIndex = 16
	#
	# btnSearch
	#
	$btnSearch.Location = '461, 65'
	$btnSearch.Name = "btnSearch"
	$btnSearch.Size = '75, 23'
	$btnSearch.TabIndex = 22
	$btnSearch.Text = "&Search"
	$btnSearch.UseVisualStyleBackColor = $True
	$btnSearch.add_Click($btnSearch_Click)
	#
	# datagridviewResults
	#
	$datagridviewResults.AllowUserToAddRows = $False
	$datagridviewResults.AllowUserToDeleteRows = $False
	$datagridviewResults.Anchor = 'Top, Bottom, Left, Right'
	$System_Windows_Forms_DataGridViewCellStyle_1 = New-Object 'System.Windows.Forms.DataGridViewCellStyle'
	$System_Windows_Forms_DataGridViewCellStyle_1.Alignment = 'MiddleLeft'
	$System_Windows_Forms_DataGridViewCellStyle_1.BackColor = 'Control'
	$System_Windows_Forms_DataGridViewCellStyle_1.Font = "Microsoft Sans Serif, 8.25pt"
	$System_Windows_Forms_DataGridViewCellStyle_1.ForeColor = 'WindowText'
	$System_Windows_Forms_DataGridViewCellStyle_1.SelectionBackColor = 'Highlight'
	$System_Windows_Forms_DataGridViewCellStyle_1.SelectionForeColor = 'HighlightText'
	$System_Windows_Forms_DataGridViewCellStyle_1.WrapMode = 'True'
	$datagridviewResults.ColumnHeadersDefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_1
	$System_Windows_Forms_DataGridViewCellStyle_2 = New-Object 'System.Windows.Forms.DataGridViewCellStyle'
	$System_Windows_Forms_DataGridViewCellStyle_2.Alignment = 'MiddleLeft'
	$System_Windows_Forms_DataGridViewCellStyle_2.BackColor = 'Window'
	$System_Windows_Forms_DataGridViewCellStyle_2.Font = "Microsoft Sans Serif, 8.25pt"
	$System_Windows_Forms_DataGridViewCellStyle_2.ForeColor = 'ControlText'
	$System_Windows_Forms_DataGridViewCellStyle_2.SelectionBackColor = 'Highlight'
	$System_Windows_Forms_DataGridViewCellStyle_2.SelectionForeColor = 'HighlightText'
	$System_Windows_Forms_DataGridViewCellStyle_2.WrapMode = 'False'
	$datagridviewResults.DefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_2
	$datagridviewResults.Location = '3, 102'
	$datagridviewResults.Name = "datagridviewResults"
	$datagridviewResults.ReadOnly = $True
	$System_Windows_Forms_DataGridViewCellStyle_3 = New-Object 'System.Windows.Forms.DataGridViewCellStyle'
	$System_Windows_Forms_DataGridViewCellStyle_3.Alignment = 'MiddleLeft'
	$System_Windows_Forms_DataGridViewCellStyle_3.BackColor = 'Control'
	$System_Windows_Forms_DataGridViewCellStyle_3.Font = "Microsoft Sans Serif, 8.25pt"
	$System_Windows_Forms_DataGridViewCellStyle_3.ForeColor = 'WindowText'
	$System_Windows_Forms_DataGridViewCellStyle_3.SelectionBackColor = 'Highlight'
	$System_Windows_Forms_DataGridViewCellStyle_3.SelectionForeColor = 'HighlightText'
	$System_Windows_Forms_DataGridViewCellStyle_3.WrapMode = 'True'
	$datagridviewResults.RowHeadersDefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_3
	$datagridviewResults.Size = '535, 227'
	$datagridviewResults.TabIndex = 25
	$datagridviewResults.add_CellMouseDoubleClick($datagridviewResults_CellMouseDoubleClick)
	#
	# btnSelect
	#
	$btnSelect.Anchor = 'Bottom, Right'
	$btnSelect.DialogResult = 'OK'
	$btnSelect.Location = '463, 335'
	$btnSelect.Name = "btnSelect"
	$btnSelect.Size = '75, 23'
	$btnSelect.TabIndex = 24
	$btnSelect.Text = "S&elect"
	$btnSelect.UseVisualStyleBackColor = $True
	$btnSelect.add_Click($btnSelect_Click)
	#
	# buttonCustomQuery
	#
	$buttonCustomQuery.Anchor = 'Bottom, Left'
	$buttonCustomQuery.Location = '3, 335'
	$buttonCustomQuery.Name = "buttonCustomQuery"
	$buttonCustomQuery.Size = '100, 23'
	$buttonCustomQuery.TabIndex = 23
	$buttonCustomQuery.Text = "Custom &Query"
	$buttonCustomQuery.UseVisualStyleBackColor = $True
	#endregion Generated Form Code

	#----------------------------------------------

	#Save the initial state of the form
	$InitialFormWindowState = $formEmployeeSearch.WindowState
	#Init the OnLoad event to correct the initial state of the form
	$formEmployeeSearch.add_Load($Form_StateCorrection_Load)
	#Clean up the control events
	$formEmployeeSearch.add_FormClosed($Form_Cleanup_FormClosed)
	#Store the control values when form is closing
	$formEmployeeSearch.add_Closing($Form_StoreValues_Closing)
	#Show the Form
	return $formEmployeeSearch.ShowDialog()

}
#endregion Source: Search.pff

#region Source: SecurityGroupMembers.pff
function Call-SecurityGroupMembers_pff
{
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
BRsAAB+LCAAAAAAABADVWVtv6kYQfq/U/2D5mXIzhKQCJC5NGp2kjSDN6Vu02EPYZr2Ldtch9Nd3
fAMbQ1hHAfUoUoTHc5/PM+N1dwKueAO5HhNN+j//ZFndPyV9oZywa8rgD+JDfwpuIKle30gRLO/B
n4FU1eV83q0VWCMF4dUT8lDB+41qs1vLEmITs3/A1ZZeL6FnT9dKg1/9TrknVqp6LaQf/69Y+25V
rERVr1Wth38VaxQwHUjocQi0JKxiPQQzRt1vsH4Ur8B7s06HtN32RePKaUH98sq2ODrbs+eoLxec
bbkLyjyJMvZIcC0FU3bkMjr9IMUSpF4nwgPXhaUeBloLnvIg1wTmgPIuJGyziGHEhALbqqW6aqmy
A8pHjALXU/ov2H2n06xYzlXjqFCYnqGQHsipXjOUvKbv4I0pYeLlqPA9eac+2huKdxQkTMFxEcrL
ioQgsfuFvB+Vm2oi9YNQVNMw2yNMDkbpSgB+VPYR3rW9AbF1wOBvb6gzkbgTxMOI0MuI+hxed2vR
75T9OIJDs5iZk4N4Cgw9AW8CCjV8hOBiau6ES+KMNhzEWPuqkJdDJcxbNR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+89ztSsjMc
vIWe+ds3vcRXP/vul/vmVMtgH5GQ/ez1H1FOWeQFGwAA#>
#endregion
param(
	[string]$GroupName
)

	#----------------------------------------------
	#region Import the Assemblies
	#----------------------------------------------
	[void][reflection.assembly]::Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	#endregion Import Assemblies

	#----------------------------------------------
	#region Generated Form Objects
	#----------------------------------------------
	[System.Windows.Forms.Application]::EnableVisualStyles()
	$formSecurityGroup = New-Object 'System.Windows.Forms.Form'
	$SelectedResult = New-Object 'System.Windows.Forms.TextBox'
	$label2 = New-Object 'System.Windows.Forms.Label'
	$listview1 = New-Object 'System.Windows.Forms.ListView'
	$buttonClose = New-Object 'System.Windows.Forms.Button'
	$labelDescription = New-Object 'System.Windows.Forms.Label'
	$labelName = New-Object 'System.Windows.Forms.Label'
	$label1 = New-Object 'System.Windows.Forms.Label'
	$Members = New-Object 'System.Windows.Forms.ColumnHeader'
	$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
	#endregion Generated Form Objects

	#----------------------------------------------
	# User Generated Script
	#----------------------------------------------
	
	
	
	$FormEvent_Load={
		#TODO: Initialize Form Controls here
		
	}
	
	#region Control Helper Functions
	function Sort-ListViewColumn 
	{
		<#
		.SYNOPSIS
			Sort the ListView's item using the specified column.
	
		.DESCRIPTION
			Sort the ListView's item using the specified column.
			This function uses Add-Type to define a class that sort the items.
			The ListView's Tag property is used to keep track of the sorting.
	
		.PARAMETER ListView
			The ListView control to sort.
	
		.PARAMETER ColumnIndex
			The index of the column to use for sorting.
			
		.PARAMETER  SortOrder
			The direction to sort the items. If not specified or set to None, it will toggle.
		
		.EXAMPLE
			Sort-ListViewColumn -ListView $listview1 -ColumnIndex 0
	#>
		param(	
				[ValidateNotNull()]
				[Parameter(Mandatory=$true)]
				[System.Windows.Forms.ListView]$ListView,
				[Parameter(Mandatory=$true)]
				[int]$ColumnIndex,
				[System.Windows.Forms.SortOrder]$SortOrder = 'None')
		
		if(($ListView.Items.Count -eq 0) -or ($ColumnIndex -lt 0) -or ($ColumnIndex -ge $ListView.Columns.Count))
		{
			return;
		}
		
		#region Define ListViewItemComparer
			try{
			$local:type = [ListViewItemComparer]
		}
		catch{
		Add-Type -ReferencedAssemblies ('System.Windows.Forms') -TypeDefinition  @" 
using System;
using System.Windows.Forms;
using System.Collections;
public class ListViewItemComparer : IComparer
{
    public int column;
    public SortOrder sortOrder;
    public ListViewItemComparer()
    {
        column = 0;
		sortOrder = SortOrder.Ascending;
    }
    public ListViewItemComparer(int column, SortOrder sort)
    {
        this.column = column;
		sortOrder = sort;
    }
    public int Compare(object x, object y)
    {
		if(column >= ((ListViewItem)x).SubItems.Count)
			return  sortOrder == SortOrder.Ascending ? -1 : 1;
	
		if(column >= ((ListViewItem)y).SubItems.Count)
			return sortOrder == SortOrder.Ascending ? 1 : -1;
	
		if(sortOrder == SortOrder.Ascending)
        	return String.Compare(((ListViewItem)x).SubItems[column].Text, ((ListViewItem)y).SubItems[column].Text);
		else
			return String.Compare(((ListViewItem)y).SubItems[column].Text, ((ListViewItem)x).SubItems[column].Text);
    }
}
"@  | Out-Null
		}
		#endregion
		
		if($ListView.Tag -is [ListViewItemComparer])
		{
			#Toggle the Sort Order
			if($SortOrder -eq [System.Windows.Forms.SortOrder]::None)
			{
				if($ListView.Tag.column -eq $ColumnIndex -and $ListView.Tag.sortOrder -eq 'Ascending')
				{
					$ListView.Tag.sortOrder = 'Descending'
				}
				else
				{
					$ListView.Tag.sortOrder = 'Ascending'
				}
			}
			else
			{
				$ListView.Tag.sortOrder = $SortOrder
			}
			
			$ListView.Tag.column = $ColumnIndex
			$ListView.Sort()#Sort the items
		}
		else
		{
			if($Sort -eq [System.Windows.Forms.SortOrder]::None)
			{
				$Sort = [System.Windows.Forms.SortOrder]::Ascending	
			}
			
			#Set to Tag because for some reason in PowerShell ListViewItemSorter prop returns null
			$ListView.Tag = New-Object ListViewItemComparer ($ColumnIndex, $SortOrder) 
			$ListView.ListViewItemSorter = $ListView.Tag #Automatically sorts
		}
	}
	
	
	function Add-ListViewItem
	{
	<#
		.SYNOPSIS
			Adds the item(s) to the ListView and stores the object in the ListViewItem's Tag property.
	
		.DESCRIPTION
			Adds the item(s) to the ListView and stores the object in the ListViewItem's Tag property.
	
		.PARAMETER ListView
			The ListView control to add the items to.
	
		.PARAMETER Items
			The object or objects you wish to load into the ListView's Items collection.
			
		.PARAMETER  ImageIndex
			The index of a predefined image in the ListView's ImageList.
		
		.PARAMETER  SubItems
			List of strings to add as Subitems.
		
		.PARAMETER Group
			The group to place the item(s) in.
		
		.PARAMETER Clear
			This switch clears the ListView's Items before adding the new item(s).
		
		.EXAMPLE
			Add-ListViewItem -ListView $listview1 -Items "Test" -Group $listview1.Groups[0] -ImageIndex 0 -SubItems "Installed"
	#>
		
		Param( 
		[ValidateNotNull()]
		[Parameter(Mandatory=$true)]
		[System.Windows.Forms.ListView]$ListView,
		[ValidateNotNull()]
		[Parameter(Mandatory=$true)]
		$Items,
		[int]$ImageIndex = -1,
		[string[]]$SubItems,
		[System.Windows.Forms.ListViewGroup]$Group,
		[switch]$Clear)
		
		if($Clear)
		{
			$ListView.Items.Clear();
		}
		
		if($Items -is [Array])
		{
			$ListView.BeginUpdate()
			foreach ($item in $Items)
			{		
				$listitem  = $ListView.Items.Add($item.ToString(), $ImageIndex)
				#Store the object in the Tag
				$listitem.Tag = $item
				
				if($SubItems -ne $null)
				{
					$listitem.SubItems.AddRange($SubItems)
				}
				
				if($Group -ne $null)
				{
					$listitem.Group = $Group
				}
			}
			$ListView.EndUpdate()
		}
		else
		{
			#Add a new item to the ListView
			$listitem  = $ListView.Items.Add($Items.ToString(), $ImageIndex)
			#Store the object in the Tag
			$listitem.Tag = $Items
			
			if($SubItems -ne $null)
			{
				$listitem.SubItems.AddRange($SubItems)
			}
			
			if($Group -ne $null)
			{
				$listitem.Group = $Group
			}
		}
	}
	
	
	#endregion
	
	$Group = Invoke-Command -Session $global:sAD -ScriptBlock {Get-ADgroup -Identity $args[0] -properties members,description,mail} -ArgumentList @($GroupName)
	$formSecurityGroup.text = $Group.Name
	$label1.Text = $Group.Mail
	$label2.Text = $Group.Description
	
	foreach ($member in $Group.members){
		$member -match 'CN=(.+?),.*$'
		Add-ListViewItem -ListView $listview1 -Items $matches[1]
	}
	
	$listview1_MouseDoubleClick=[System.Windows.Forms.MouseEventHandler]{
	#Event Argument: $_ = [System.Windows.Forms.MouseEventArgs]
		$SelectedResult.Text = $listview1.SelectedItems[0].Text
		$formSecurityGroup.DialogResult = 'Yes'
		$formSecurityGroup.Close()
		
	}
	
	$buttonClose_Click={
		$formSecurityGroup.Close()
	}
	
	
	
	# --End User Generated Script--
	#----------------------------------------------
	#region Generated Events
	#----------------------------------------------
	
	$Form_StateCorrection_Load=
	{
		#Correct the initial state of the form to prevent the .Net maximized form issue
		$formSecurityGroup.WindowState = $InitialFormWindowState
	}
	
	$Form_StoreValues_Closing=
	{
		#Store the control values
		$script:SecurityGroupMembers_SelectedResult = $SelectedResult.Text
		$script:SecurityGroupMembers_listview1 = $listview1.SelectedItems
	}

	
	$Form_Cleanup_FormClosed=
	{
		#Remove all event handlers from the controls
		try
		{
			$listview1.remove_MouseDoubleClick($listview1_MouseDoubleClick)
			$buttonClose.remove_Click($buttonClose_Click)
			$formSecurityGroup.remove_Load($FormEvent_Load)
			$formSecurityGroup.remove_Load($Form_StateCorrection_Load)
			$formSecurityGroup.remove_Closing($Form_StoreValues_Closing)
			$formSecurityGroup.remove_FormClosed($Form_Cleanup_FormClosed)
		}
		catch [Exception]
		{ }
	}
	#endregion Generated Events

	#----------------------------------------------
	#region Generated Form Code
	#----------------------------------------------
	#
	# formSecurityGroup
	#
	$formSecurityGroup.Controls.Add($SelectedResult)
	$formSecurityGroup.Controls.Add($label2)
	$formSecurityGroup.Controls.Add($listview1)
	$formSecurityGroup.Controls.Add($buttonClose)
	$formSecurityGroup.Controls.Add($labelDescription)
	$formSecurityGroup.Controls.Add($labelName)
	$formSecurityGroup.Controls.Add($label1)
	$formSecurityGroup.AcceptButton = $buttonClose
	$formSecurityGroup.ClientSize = '372, 391'
	$formSecurityGroup.FormBorderStyle = 'FixedDialog'
	$formSecurityGroup.MaximizeBox = $False
	$formSecurityGroup.MinimizeBox = $False
	$formSecurityGroup.Name = "formSecurityGroup"
	$formSecurityGroup.StartPosition = 'CenterScreen'
	$formSecurityGroup.Text = "Security Group"
	$formSecurityGroup.add_Load($FormEvent_Load)
	#
	# SelectedResult
	#
	$SelectedResult.Location = '13, 359'
	$SelectedResult.Name = "SelectedResult"
	$SelectedResult.Size = '100, 20'
	$SelectedResult.TabIndex = 33
	$SelectedResult.Visible = $False
	#
	# label2
	#
	$label2.Location = '86, 31'
	$label2.Name = "label2"
	$label2.Size = '274, 28'
	$label2.TabIndex = 3
	#
	# listview1
	#
	$listview1.AllowColumnReorder = $True
	[void]$listview1.Columns.Add($Members)
	$listview1.FullRowSelect = $True
	$listview1.GridLines = $True
	$listview1.Location = '13, 62'
	$listview1.Name = "listview1"
	$listview1.Size = '347, 285'
	$listview1.Sorting = 'Ascending'
	$listview1.TabIndex = 1
	$listview1.UseCompatibleStateImageBehavior = $False
	$listview1.View = 'Details'
	$listview1.add_MouseDoubleClick($listview1_MouseDoubleClick)
	#
	# buttonClose
	#
	$buttonClose.Anchor = 'Bottom, Right'
	$buttonClose.Location = '285, 356'
	$buttonClose.Name = "buttonClose"
	$buttonClose.Size = '75, 23'
	$buttonClose.TabIndex = 0
	$buttonClose.Text = "Close"
	$buttonClose.UseVisualStyleBackColor = $True
	$buttonClose.add_Click($buttonClose_Click)
	#
	# labelDescription
	#
	$labelDescription.Font = "Microsoft Sans Serif, 8.25pt, style=Bold"
	$labelDescription.Location = '13, 31'
	$labelDescription.Name = "labelDescription"
	$labelDescription.Size = '100, 23'
	$labelDescription.TabIndex = 5
	$labelDescription.Text = "Description:"
	#
	# labelName
	#
	$labelName.Font = "Microsoft Sans Serif, 8.25pt, style=Bold"
	$labelName.Location = '13, 15'
	$labelName.Name = "labelName"
	$labelName.Size = '55, 23'
	$labelName.TabIndex = 4
	$labelName.Text = "Name:"
	#
	# label1
	#
	$label1.Location = '86, 15'
	$label1.Name = "label1"
	$label1.Size = '274, 16'
	$label1.TabIndex = 2
	#
	# Members
	#
	$Members.Text = "Members"
	$Members.Width = 315
	#endregion Generated Form Code

	#----------------------------------------------

	#Save the initial state of the form
	$InitialFormWindowState = $formSecurityGroup.WindowState
	#Init the OnLoad event to correct the initial state of the form
	$formSecurityGroup.add_Load($Form_StateCorrection_Load)
	#Clean up the control events
	$formSecurityGroup.add_FormClosed($Form_Cleanup_FormClosed)
	#Store the control values when form is closing
	$formSecurityGroup.add_Closing($Form_StoreValues_Closing)
	#Show the Form
	return $formSecurityGroup.ShowDialog()

}
#endregion Source: SecurityGroupMembers.pff

#region Source: SecGroupMirror.pff
function Call-SecGroupMirror_pff
{
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
kzUAAB+LCAAAAAAABADtW+tz2jgQ/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Vd5tChuJXQjNnfZUk0jXR0m+k7kE1EtgXSEhe
wvof5MaVX5M1AAA=#>
#endregion
Param(
	[ValidateNotNull()]
	[Parameter(Mandatory=$true)]
	[System.Windows.Forms.ListView]$ListView,
	[string]$EmployeeID
)

	#----------------------------------------------
	#region Import the Assemblies
	#----------------------------------------------
	[void][reflection.assembly]::Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	#endregion Import Assemblies

	#----------------------------------------------
	#region Generated Form Objects
	#----------------------------------------------
	[System.Windows.Forms.Application]::EnableVisualStyles()
	$form1 = New-Object 'System.Windows.Forms.Form'
	$groupBox1 = New-Object 'System.Windows.Forms.GroupBox'
	$buttonCompare = New-Object 'System.Windows.Forms.Button'
	$buttonClear = New-Object 'System.Windows.Forms.Button'
	$buttonApply = New-Object 'System.Windows.Forms.Button'
	$button4 = New-Object 'System.Windows.Forms.Button'
	$button1 = New-Object 'System.Windows.Forms.Button'
	$groupBox3 = New-Object 'System.Windows.Forms.GroupBox'
	$lvSecondary = New-Object 'System.Windows.Forms.ListView'
	$buttonSelectAll = New-Object 'System.Windows.Forms.Button'
	$labelEmpNoSAM = New-Object 'System.Windows.Forms.Label'
	$buttonGet = New-Object 'System.Windows.Forms.Button'
	$textBox2 = New-Object 'System.Windows.Forms.TextBox'
	$groupBox2 = New-Object 'System.Windows.Forms.GroupBox'
	$lvMain = New-Object 'System.Windows.Forms.ListView'
	$button30 = New-Object 'System.Windows.Forms.Button'
	$button31 = New-Object 'System.Windows.Forms.Button'
	$textBox1 = New-Object 'System.Windows.Forms.TextBox'
	$label2 = New-Object 'System.Windows.Forms.Label'
	$buttonOK = New-Object 'System.Windows.Forms.Button'
	$GroupName = New-Object 'System.Windows.Forms.ColumnHeader'
	$lvSecondaryGroupName = New-Object 'System.Windows.Forms.ColumnHeader'
	$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
	#endregion Generated Form Objects

	#----------------------------------------------
	# User Generated Script
	#----------------------------------------------
	
	
	$FormEvent_Load={
		#TODO: Initialize Form Controls here
		
	}
	function LVArrayGenerator{
		Param($LV)
		$array = @()
		$count = $LV.Items.Count
		for ($i=0; $i -lt $count; $i++){
			$array += $LV.Items[$i].Text
		}
		#Write-Host $array
		return $array
	}
	#region Control Helper Functions
	function Sort-ListViewColumn 
	{
		<#
		.SYNOPSIS
			Sort the ListView's item using the specified column.
	
		.DESCRIPTION
			Sort the ListView's item using the specified column.
			This function uses Add-Type to define a class that sort the items.
			The ListView's Tag property is used to keep track of the sorting.
	
		.PARAMETER ListView
			The ListView control to sort.
	
		.PARAMETER ColumnIndex
			The index of the column to use for sorting.
			
		.PARAMETER  SortOrder
			The direction to sort the items. If not specified or set to None, it will toggle.
		
		.EXAMPLE
			Sort-ListViewColumn -ListView $listview1 -ColumnIndex 0
	#>
		param(	
				[ValidateNotNull()]
				[Parameter(Mandatory=$true)]
				[System.Windows.Forms.ListView]$ListView,
				[Parameter(Mandatory=$true)]
				[int]$ColumnIndex,
				[System.Windows.Forms.SortOrder]$SortOrder = 'None')
		
		if(($ListView.Items.Count -eq 0) -or ($ColumnIndex -lt 0) -or ($ColumnIndex -ge $ListView.Columns.Count))
		{
			return;
		}
		
		#region Define ListViewItemComparer
			try{
			$local:type = [ListViewItemComparer]
		}
		catch{
		Add-Type -ReferencedAssemblies ('System.Windows.Forms') -TypeDefinition  @" 
using System;
using System.Windows.Forms;
using System.Collections;
public class ListViewItemComparer : IComparer
{
    public int column;
    public SortOrder sortOrder;
    public ListViewItemComparer()
    {
        column = 0;
		sortOrder = SortOrder.Ascending;
    }
    public ListViewItemComparer(int column, SortOrder sort)
    {
        this.column = column;
		sortOrder = sort;
    }
    public int Compare(object x, object y)
    {
		if(column >= ((ListViewItem)x).SubItems.Count)
			return  sortOrder == SortOrder.Ascending ? -1 : 1;
	
		if(column >= ((ListViewItem)y).SubItems.Count)
			return sortOrder == SortOrder.Ascending ? 1 : -1;
	
		if(sortOrder == SortOrder.Ascending)
        	return String.Compare(((ListViewItem)x).SubItems[column].Text, ((ListViewItem)y).SubItems[column].Text);
		else
			return String.Compare(((ListViewItem)y).SubItems[column].Text, ((ListViewItem)x).SubItems[column].Text);
    }
}
"@  | Out-Null
		}
		#endregion
		
		if($ListView.Tag -is [ListViewItemComparer])
		{
			#Toggle the Sort Order
			if($SortOrder -eq [System.Windows.Forms.SortOrder]::None)
			{
				if($ListView.Tag.column -eq $ColumnIndex -and $ListView.Tag.sortOrder -eq 'Ascending')
				{
					$ListView.Tag.sortOrder = 'Descending'
				}
				else
				{
					$ListView.Tag.sortOrder = 'Ascending'
				}
			}
			else
			{
				$ListView.Tag.sortOrder = $SortOrder
			}
			
			$ListView.Tag.column = $ColumnIndex
			$ListView.Sort()#Sort the items
		}
		else
		{
			if($Sort -eq [System.Windows.Forms.SortOrder]::None)
			{
				$Sort = [System.Windows.Forms.SortOrder]::Ascending	
			}
			
			#Set to Tag because for some reason in PowerShell ListViewItemSorter prop returns null
			$ListView.Tag = New-Object ListViewItemComparer ($ColumnIndex, $SortOrder) 
			$ListView.ListViewItemSorter = $ListView.Tag #Automatically sorts
		}
	}
	
	
	function Add-ListViewItem
	{
	<#
		.SYNOPSIS
			Adds the item(s) to the ListView and stores the object in the ListViewItem's Tag property.
	
		.DESCRIPTION
			Adds the item(s) to the ListView and stores the object in the ListViewItem's Tag property.
	
		.PARAMETER ListView
			The ListView control to add the items to.
	
		.PARAMETER Items
			The object or objects you wish to load into the ListView's Items collection.
			
		.PARAMETER  ImageIndex
			The index of a predefined image in the ListView's ImageList.
		
		.PARAMETER  SubItems
			List of strings to add as Subitems.
		
		.PARAMETER Group
			The group to place the item(s) in.
		
		.PARAMETER Clear
			This switch clears the ListView's Items before adding the new item(s).
		
		.EXAMPLE
			Add-ListViewItem -ListView $listview1 -Items "Test" -Group $listview1.Groups[0] -ImageIndex 0 -SubItems "Installed"
	#>
		
		Param( 
		[ValidateNotNull()]
		[Parameter(Mandatory=$true)]
		[System.Windows.Forms.ListView]$ListView,
		[ValidateNotNull()]
		[Parameter(Mandatory=$true)]
		$Items,
		[int]$ImageIndex = -1,
		[string[]]$SubItems,
		[System.Windows.Forms.ListViewGroup]$Group,
		[switch]$Clear)
		
		if($Clear)
		{
			$ListView.Items.Clear();
		}
		
		if($Items -is [Array])
		{
			$ListView.BeginUpdate()
			foreach ($item in $Items)
			{		
				$listitem  = $ListView.Items.Add($item.ToString(), $ImageIndex)
				#Store the object in the Tag
				$listitem.Tag = $item
				
				if($SubItems -ne $null)
				{
					$listitem.SubItems.AddRange($SubItems)
				}
				
				if($Group -ne $null)
				{
					$listitem.Group = $Group
				}
			}
			$ListView.EndUpdate()
		}
		else
		{
			#Add a new item to the ListView
			$listitem  = $ListView.Items.Add($Items.ToString(), $ImageIndex)
			#Store the object in the Tag
			$listitem.Tag = $Items
			
			if($SubItems -ne $null)
			{
				$listitem.SubItems.AddRange($SubItems)
			}
			
			if($Group -ne $null)
			{
				$listitem.Group = $Group
			}
		}
	}
	
	
	function Load-ListBox 
	{
	<#
		.SYNOPSIS
			This functions helps you load items into a ListBox or CheckedListBox.
	
		.DESCRIPTION
			Use this function to dynamically load items into the ListBox control.
	
		.PARAMETER  ListBox
			The ListBox control you want to add items to.
	
		.PARAMETER  Items
			The object or objects you wish to load into the ListBox's Items collection.
	
		.PARAMETER  DisplayMember
			Indicates the property to display for the items in this control.
		
		.PARAMETER  Append
			Adds the item(s) to the ListBox without clearing the Items collection.
		
		.EXAMPLE
			Load-ListBox $ListBox1 "Red", "White", "Blue"
		
		.EXAMPLE
			Load-ListBox $listBox1 "Red" -Append
			Load-ListBox $listBox1 "White" -Append
			Load-ListBox $listBox1 "Blue" -Append
		
		.EXAMPLE
			Load-ListBox $listBox1 (Get-Process) "ProcessName"
	#>
		Param (
			[ValidateNotNull()]
			[Parameter(Mandatory=$true)]
			[System.Windows.Forms.ListBox]$ListBox,
			[ValidateNotNull()]
			[Parameter(Mandatory=$true)]
			$Items,
		    [Parameter(Mandatory=$false)]
			[string]$DisplayMember,
			[switch]$Append
		)
		
		if(-not $Append)
		{
			$listBox.Items.Clear()	
		}
		
		if($Items -is [System.Windows.Forms.ListBox+ObjectCollection])
		{
			$listBox.Items.AddRange($Items)
		}
		elseif ($Items -is [Array])
		{
			$listBox.BeginUpdate()
			foreach($obj in $Items)
			{
				$listBox.Items.Add($obj)
			}
			$listBox.EndUpdate()
		}
		else
		{
			$listBox.Items.Add($Items)	
		}
	
		$listBox.DisplayMember = $DisplayMember	
	}
	#endregion
	
	$array = LVArrayGenerator -LV $ListView
	foreach ($a in $array){
		Add-ListViewItem -ListView $lvMain -Items $a
	}
	
	
	# --End User Generated Script--
	#----------------------------------------------
	#region Generated Events
	#----------------------------------------------
	
	$Form_StateCorrection_Load=
	{
		#Correct the initial state of the form to prevent the .Net maximized form issue
		$form1.WindowState = $InitialFormWindowState
	}
	
	$Form_StoreValues_Closing=
	{
		#Store the control values
		$script:SecGroupMirror_lvSecondary = $lvSecondary.SelectedItems
		$script:SecGroupMirror_textBox2 = $textBox2.Text
		$script:SecGroupMirror_lvMain = $lvMain.SelectedItems
		$script:SecGroupMirror_textBox1 = $textBox1.Text
	}

	
	$Form_Cleanup_FormClosed=
	{
		#Remove all event handlers from the controls
		try
		{
			$form1.remove_Load($FormEvent_Load)
			$form1.remove_Load($Form_StateCorrection_Load)
			$form1.remove_Closing($Form_StoreValues_Closing)
			$form1.remove_FormClosed($Form_Cleanup_FormClosed)
		}
		catch [Exception]
		{ }
	}
	#endregion Generated Events

	#----------------------------------------------
	#region Generated Form Code
	#----------------------------------------------
	#
	# form1
	#
	$form1.Controls.Add($groupBox1)
	$form1.Controls.Add($buttonOK)
	$form1.AcceptButton = $buttonOK
	$form1.ClientSize = '852, 333'
	$form1.FormBorderStyle = 'FixedDialog'
	$form1.MaximizeBox = $False
	$form1.MinimizeBox = $False
	$form1.Name = "form1"
	$form1.StartPosition = 'CenterScreen'
	$form1.Text = "Form"
	$form1.add_Load($FormEvent_Load)
	#
	# groupBox1
	#
	$groupBox1.Controls.Add($buttonCompare)
	$groupBox1.Controls.Add($buttonClear)
	$groupBox1.Controls.Add($buttonApply)
	$groupBox1.Controls.Add($button4)
	$groupBox1.Controls.Add($button1)
	$groupBox1.Controls.Add($groupBox3)
	$groupBox1.Controls.Add($groupBox2)
	$groupBox1.BackColor = 'Transparent'
	$groupBox1.Location = '12, 40'
	$groupBox1.Name = "groupBox1"
	$groupBox1.Size = '825, 241'
	$groupBox1.TabIndex = 58
	$groupBox1.TabStop = $False
	$groupBox1.Text = "Security Group Mirror Tool"
	#
	# buttonCompare
	#
	$buttonCompare.Location = '375, 57'
	$buttonCompare.Name = "buttonCompare"
	$buttonCompare.Size = '75, 26'
	$buttonCompare.TabIndex = 6
	$buttonCompare.Text = "Compare"
	$buttonCompare.UseVisualStyleBackColor = $True
	#
	# buttonClear
	#
	$buttonClear.Location = '375, 88'
	$buttonClear.Name = "buttonClear"
	$buttonClear.Size = '75, 26'
	$buttonClear.TabIndex = 5
	$buttonClear.Text = "Clear"
	$buttonClear.UseVisualStyleBackColor = $True
	#
	# buttonApply
	#
	$buttonApply.Location = '375, 183'
	$buttonApply.Name = "buttonApply"
	$buttonApply.Size = '75, 26'
	$buttonApply.TabIndex = 4
	$buttonApply.Text = "Apply"
	$buttonApply.UseVisualStyleBackColor = $True
	#
	# button4
	#
	$button4.Location = '375, 151'
	$button4.Name = "button4"
	$button4.Size = '75, 26'
	$button4.TabIndex = 3
	$button4.Text = "<-----"
	$button4.UseVisualStyleBackColor = $True
	#
	# button1
	#
	$button1.Location = '375, 120'
	$button1.Name = "button1"
	$button1.Size = '75, 26'
	$button1.TabIndex = 2
	$button1.Text = "---->"
	$button1.UseVisualStyleBackColor = $True
	#
	# groupBox3
	#
	$groupBox3.Controls.Add($lvSecondary)
	$groupBox3.Controls.Add($buttonSelectAll)
	$groupBox3.Controls.Add($labelEmpNoSAM)
	$groupBox3.Controls.Add($buttonGet)
	$groupBox3.Controls.Add($textBox2)
	$groupBox3.BackColor = 'LightGray'
	$groupBox3.Location = '456, 18'
	$groupBox3.Name = "groupBox3"
	$groupBox3.Size = '363, 218'
	$groupBox3.TabIndex = 1
	$groupBox3.TabStop = $False
	$groupBox3.Text = "User 2"
	#
	# lvSecondary
	#
	[void]$lvSecondary.Columns.Add($lvSecondaryGroupName)
	$lvSecondary.Location = '6, 39'
	$lvSecondary.Name = "lvSecondary"
	$lvSecondary.Size = '351, 173'
	$lvSecondary.TabIndex = 55
	$lvSecondary.UseCompatibleStateImageBehavior = $False
	$lvSecondary.View = 'Details'
	#
	# buttonSelectAll
	#
	$buttonSelectAll.Location = '274, 10'
	$buttonSelectAll.Name = "buttonSelectAll"
	$buttonSelectAll.Size = '83, 23'
	$buttonSelectAll.TabIndex = 54
	$buttonSelectAll.Text = "Select All"
	$buttonSelectAll.UseVisualStyleBackColor = $True
	#
	# labelEmpNoSAM
	#
	$labelEmpNoSAM.AutoSize = $True
	$labelEmpNoSAM.Location = '6, 15'
	$labelEmpNoSAM.Name = "labelEmpNoSAM"
	$labelEmpNoSAM.Size = '73, 13'
	$labelEmpNoSAM.TabIndex = 53
	$labelEmpNoSAM.Text = "EmpNo/SAM:"
	#
	# buttonGet
	#
	$buttonGet.Location = '187, 10'
	$buttonGet.Name = "buttonGet"
	$buttonGet.Size = '83, 23'
	$buttonGet.TabIndex = 51
	$buttonGet.Text = "Get"
	$buttonGet.UseVisualStyleBackColor = $True
	#
	# textBox2
	#
	$textBox2.Location = '84, 12'
	$textBox2.Name = "textBox2"
	$textBox2.Size = '97, 20'
	$textBox2.TabIndex = 52
	#
	# groupBox2
	#
	$groupBox2.Controls.Add($lvMain)
	$groupBox2.Controls.Add($button30)
	$groupBox2.Controls.Add($button31)
	$groupBox2.Controls.Add($textBox1)
	$groupBox2.Controls.Add($label2)
	$groupBox2.BackColor = 'LightGray'
	$groupBox2.Location = '6, 18'
	$groupBox2.Name = "groupBox2"
	$groupBox2.Size = '363, 218'
	$groupBox2.TabIndex = 0
	$groupBox2.TabStop = $False
	$groupBox2.Text = "User 1"
	#
	# lvMain
	#
	[void]$lvMain.Columns.Add($GroupName)
	$lvMain.Location = '6, 38'
	$lvMain.Name = "lvMain"
	$lvMain.Size = '351, 174'
	$lvMain.TabIndex = 50
	$lvMain.UseCompatibleStateImageBehavior = $False
	$lvMain.View = 'Details'
	#
	# button30
	#
	$button30.Location = '274, 10'
	$button30.Name = "button30"
	$button30.Size = '83, 23'
	$button30.TabIndex = 49
	$button30.Text = "Select All"
	$button30.UseVisualStyleBackColor = $True
	#
	# button31
	#
	$button31.Location = '187, 10'
	$button31.Name = "button31"
	$button31.Size = '83, 23'
	$button31.TabIndex = 48
	$button31.Text = "Get"
	$button31.UseVisualStyleBackColor = $True
	#
	# textBox1
	#
	$textBox1.Location = '84, 12'
	$textBox1.Name = "textBox1"
	$textBox1.Size = '97, 20'
	$textBox1.TabIndex = 48
	#
	# label2
	#
	$label2.AutoSize = $True
	$label2.Location = '6, 15'
	$label2.Name = "label2"
	$label2.Size = '73, 13'
	$label2.TabIndex = 48
	$label2.Text = "EmpNo/SAM:"
	#
	# buttonOK
	#
	$buttonOK.Anchor = 'Bottom, Right'
	$buttonOK.DialogResult = 'OK'
	$buttonOK.Location = '765, 298'
	$buttonOK.Name = "buttonOK"
	$buttonOK.Size = '75, 23'
	$buttonOK.TabIndex = 0
	$buttonOK.Text = "OK"
	$buttonOK.UseVisualStyleBackColor = $True
	#
	# GroupName
	#
	$GroupName.Text = "Group Name"
	$GroupName.Width = 319
	#
	# lvSecondaryGroupName
	#
	$lvSecondaryGroupName.Text = "Group Name"
	$lvSecondaryGroupName.Width = 318
	#endregion Generated Form Code

	#----------------------------------------------

	#Save the initial state of the form
	$InitialFormWindowState = $form1.WindowState
	#Init the OnLoad event to correct the initial state of the form
	$form1.add_Load($Form_StateCorrection_Load)
	#Clean up the control events
	$form1.add_FormClosed($Form_Cleanup_FormClosed)
	#Store the control values when form is closing
	$form1.add_Closing($Form_StoreValues_Closing)
	#Show the Form
	return $form1.ShowDialog()

}
#endregion Source: SecGroupMirror.pff

#region Source: UserGroupDetails.pff
function Call-UserGroupDetails_pff
{
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
2RQAAB+LCAAAAAAABADdWG1v4kYQ/l6p/8Hyl36hgDEvFwksBWhSlFyDAsndt2qxx2F7ay9ar0l8
v77jN7CxwU50oF4VKcLjmdmZ2WefWc/wEUy+BRFMiSTGr78oyvBB0BfqEnZDGfxFHDCePBC3gvub
KUhCmdfc2PawVVCLjMOnZxAe5a6hNTvDVlYQu1/9A6ZUZLCBkboIPAlO8wt1Lf7qNW+4cOL/DaXs
VUNJXI26zXb411AmPpO+gJELvhSENZS5v2LUvINgyb+BO1oNBqRn9vrald6F9qcrVXEx2JFqo7+n
26mqmGvKLIGa6oS7UnDmqVGgGOpc8A0IGSQm16YJGzn2peRuqoNaj2AD2puQqK0ihYc7VWmljlqp
pyOeJ4yCKxf0O6jGoItZdfvtSqOwImMuLBALGTC0vKFvYE0pYfyl0vgzeaMOrjfmb2hImAfVJtR9
r0mIC9VISl2pvZBEyDn3qKRhgSdYEszNFABupe0S3qQaIfU3T4nA6ikJXIu2f2zRdWJ4z4mF6WCI
kfTv8HnYin6n6tWIvaeefKbwenbUYhnZ9mkWJ3gKuyXodc01F6qx5JuGMuaIUTxk92DLQn1K8MmZ
77gZ56gywzxP1SS2+RMIAvR8dclEVHIUI/ztjmF8FMO4f7Y8lhje/yGPKXimoJvofJ9KpwYk77lJ
Yp7QOg1F69Qwidkod4RqWCWsrPWRlduDGgZLspq5FiBJajW0kbIm3NlgLisGyIASZg55gTGsyZaG
57WcaYuOQv5RjaOc14pZrD6nxX3u7Iy275YfIbOUxx7py7oOkcXd8RE8jFY1Hu7eBbR+T0cMdHq1
oZbmVh9lvYbS0d+FseI94VhzrBUHwvGZej5h0Z1iTMxvyBtR2xB+Sb/Poir/UA2wyxBSbkNO3R1C
jcprxhdqyTUe7KvDTfpPJ5+l3ZM1yCjWLUVX+6lKEXXSkzUINeomf3XYD/K5X3seOBgWeKmbRBIY
SZqfiYtk7+Bls3ntI5NFTLNPV6+brq6tbP1Tr08svd8FHSlqt9Lhyo5ncsHo6gcU9cQqZ9rG6hWn
grxS9+Uja7V1u2cPbE2zem2ik8q1LpMPfpdfZKGvDrtMQlTgAeEiWIDYUhM+BIv3bhWSjICLpJdk
hayAqZ0ht91jyirDOTZpJBGRRnQLLqDjTIuPFXZDmuSGXSZNhDMzmdbkVPNSpC5qgycnAiLWCm+7
BdlOe+J7SG/p+4zvYy/mjMhwcGD8Ht6i04f90MV3F8vr8PaT/Nob8lcQizUwlo6dwm+DgjC9wOSr
NVyA6QuKPL+b3eQNCiOuaFeLY660aVi+KQvKB/JD/cONKpNmOnVGtVQafV64Qbbmh5IJ3wQivELn
lAqyWTiQcQk7CLBcXDofjA2Ov8LInP3kJYk1Ixm2crPEVgb7iITsKPNfxJsLe9kUAAA=#>
#endregion
param(
	 [string[]]$groups
)

	#----------------------------------------------
	#region Import the Assemblies
	#----------------------------------------------
	[void][reflection.assembly]::Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	#endregion Import Assemblies

	#----------------------------------------------
	#region Generated Form Objects
	#----------------------------------------------
	[System.Windows.Forms.Application]::EnableVisualStyles()
	$formUGD = New-Object 'System.Windows.Forms.Form'
	$UGDlvUIGroups = New-Object 'System.Windows.Forms.ListView'
	$buttonOK = New-Object 'System.Windows.Forms.Button'
	$Name = New-Object 'System.Windows.Forms.ColumnHeader'
	$Description = New-Object 'System.Windows.Forms.ColumnHeader'
	$Type = New-Object 'System.Windows.Forms.ColumnHeader'
	$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
	#endregion Generated Form Objects

	#----------------------------------------------
	# User Generated Script
	#----------------------------------------------
	
	
	
	$FormEvent_Load={
		#TODO: Initialize Form Controls here
		
	}
	
	#region Control Helper Functions
	function Sort-ListViewColumn 
	{
		<#
		.SYNOPSIS
			Sort the ListView's item using the specified column.
	
		.DESCRIPTION
			Sort the ListView's item using the specified column.
			This function uses Add-Type to define a class that sort the items.
			The ListView's Tag property is used to keep track of the sorting.
	
		.PARAMETER ListView
			The ListView control to sort.
	
		.PARAMETER ColumnIndex
			The index of the column to use for sorting.
			
		.PARAMETER  SortOrder
			The direction to sort the items. If not specified or set to None, it will toggle.
		
		.EXAMPLE
			Sort-ListViewColumn -ListView $listview1 -ColumnIndex 0
	#>
		param(	
				[ValidateNotNull()]
				[Parameter(Mandatory=$true)]
				[System.Windows.Forms.ListView]$ListView,
				[Parameter(Mandatory=$true)]
				[int]$ColumnIndex,
				[System.Windows.Forms.SortOrder]$SortOrder = 'None')
		
		if(($ListView.Items.Count -eq 0) -or ($ColumnIndex -lt 0) -or ($ColumnIndex -ge $ListView.Columns.Count))
		{
			return;
		}
		
		#region Define ListViewItemComparer
			try{
			$local:type = [ListViewItemComparer]
		}
		catch{
		Add-Type -ReferencedAssemblies ('System.Windows.Forms') -TypeDefinition  @" 
using System;
using System.Windows.Forms;
using System.Collections;
public class ListViewItemComparer : IComparer
{
    public int column;
    public SortOrder sortOrder;
    public ListViewItemComparer()
    {
        column = 0;
		sortOrder = SortOrder.Ascending;
    }
    public ListViewItemComparer(int column, SortOrder sort)
    {
        this.column = column;
		sortOrder = sort;
    }
    public int Compare(object x, object y)
    {
		if(column >= ((ListViewItem)x).SubItems.Count)
			return  sortOrder == SortOrder.Ascending ? -1 : 1;
	
		if(column >= ((ListViewItem)y).SubItems.Count)
			return sortOrder == SortOrder.Ascending ? 1 : -1;
	
		if(sortOrder == SortOrder.Ascending)
        	return String.Compare(((ListViewItem)x).SubItems[column].Text, ((ListViewItem)y).SubItems[column].Text);
		else
			return String.Compare(((ListViewItem)y).SubItems[column].Text, ((ListViewItem)x).SubItems[column].Text);
    }
}
"@  | Out-Null
		}
		#endregion
		
		if($ListView.Tag -is [ListViewItemComparer])
		{
			#Toggle the Sort Order
			if($SortOrder -eq [System.Windows.Forms.SortOrder]::None)
			{
				if($ListView.Tag.column -eq $ColumnIndex -and $ListView.Tag.sortOrder -eq 'Ascending')
				{
					$ListView.Tag.sortOrder = 'Descending'
				}
				else
				{
					$ListView.Tag.sortOrder = 'Ascending'
				}
			}
			else
			{
				$ListView.Tag.sortOrder = $SortOrder
			}
			
			$ListView.Tag.column = $ColumnIndex
			$ListView.Sort()#Sort the items
		}
		else
		{
			if($Sort -eq [System.Windows.Forms.SortOrder]::None)
			{
				$Sort = [System.Windows.Forms.SortOrder]::Ascending	
			}
			
			#Set to Tag because for some reason in PowerShell ListViewItemSorter prop returns null
			$ListView.Tag = New-Object ListViewItemComparer ($ColumnIndex, $SortOrder) 
			$ListView.ListViewItemSorter = $ListView.Tag #Automatically sorts
		}
	}
	
	
	function Add-ListViewItem
	{
	<#
		.SYNOPSIS
			Adds the item(s) to the ListView and stores the object in the ListViewItem's Tag property.
	
		.DESCRIPTION
			Adds the item(s) to the ListView and stores the object in the ListViewItem's Tag property.
	
		.PARAMETER ListView
			The ListView control to add the items to.
	
		.PARAMETER Items
			The object or objects you wish to load into the ListView's Items collection.
			
		.PARAMETER  ImageIndex
			The index of a predefined image in the ListView's ImageList.
		
		.PARAMETER  SubItems
			List of strings to add as Subitems.
		
		.PARAMETER Group
			The group to place the item(s) in.
		
		.PARAMETER Clear
			This switch clears the ListView's Items before adding the new item(s).
		
		.EXAMPLE
			Add-ListViewItem -ListView $listview1 -Items "Test" -Group $listview1.Groups[0] -ImageIndex 0 -SubItems "Installed"
	#>
		
		Param( 
		[ValidateNotNull()]
		[Parameter(Mandatory=$true)]
		[System.Windows.Forms.ListView]$ListView,
		[ValidateNotNull()]
		[Parameter(Mandatory=$true)]
		$Items,
		[int]$ImageIndex = -1,
		[string[]]$SubItems,
		[System.Windows.Forms.ListViewGroup]$Group,
		[switch]$Clear)
		
		if($Clear)
		{
			$ListView.Items.Clear();
		}
		
		if($Items -is [Array])
		{
			$ListView.BeginUpdate()
			foreach ($item in $Items)
			{		
				$listitem  = $ListView.Items.Add($item.ToString(), $ImageIndex)
				#Store the object in the Tag
				$listitem.Tag = $item
				
				if($SubItems -ne $null)
				{
					$listitem.SubItems.AddRange($SubItems)
				}
				
				if($Group -ne $null)
				{
					$listitem.Group = $Group
				}
			}
			$ListView.EndUpdate()
		}
		else
		{
			#Add a new item to the ListView
			$listitem  = $ListView.Items.Add($Items.ToString(), $ImageIndex)
			#Store the object in the Tag
			$listitem.Tag = $Items
			
			if($SubItems -ne $null)
			{
				$listitem.SubItems.AddRange($SubItems)
			}
			
			if($Group -ne $null)
			{
				$listitem.Group = $Group
			}
		}
	}
	
	foreach($g in $groups){
		$g -match '^CN=(.+?),OU=(.+?),.*$'
		$group = $(try{Invoke-Command -Session $sAD -ScriptBlock {Get-ADGroup -Identity $args[0] -Properties description} -ArgumentList @($matches[1])}catch{[System.Windows.Forms.MessageBox]::Show($_.Exception.Message)})
		Add-ListViewItem -ListView $UGDlvUIGroups -Items $matches[1] -SubItems $matches[2],$group.description
	}
	
	
	#endregion
	
	
	
	# --End User Generated Script--
	#----------------------------------------------
	#region Generated Events
	#----------------------------------------------
	
	$Form_StateCorrection_Load=
	{
		#Correct the initial state of the form to prevent the .Net maximized form issue
		$formUGD.WindowState = $InitialFormWindowState
	}
	
	$Form_StoreValues_Closing=
	{
		#Store the control values
		$script:UserGroupDetails_UGDlvUIGroups = $UGDlvUIGroups.SelectedItems
	}

	
	$Form_Cleanup_FormClosed=
	{
		#Remove all event handlers from the controls
		try
		{
			$formUGD.remove_Load($FormEvent_Load)
			$formUGD.remove_Load($Form_StateCorrection_Load)
			$formUGD.remove_Closing($Form_StoreValues_Closing)
			$formUGD.remove_FormClosed($Form_Cleanup_FormClosed)
		}
		catch [Exception]
		{ }
	}
	#endregion Generated Events

	#----------------------------------------------
	#region Generated Form Code
	#----------------------------------------------
	#
	# formUGD
	#
	$formUGD.Controls.Add($UGDlvUIGroups)
	$formUGD.Controls.Add($buttonOK)
	$formUGD.AcceptButton = $buttonOK
	$formUGD.ClientSize = '740, 460'
	$formUGD.FormBorderStyle = 'FixedDialog'
	$formUGD.MaximizeBox = $False
	$formUGD.MinimizeBox = $False
	$formUGD.Name = "formUGD"
	$formUGD.StartPosition = 'CenterScreen'
	$formUGD.Text = "User's Groups Details"
	$formUGD.add_Load($FormEvent_Load)
	#
	# UGDlvUIGroups
	#
	$UGDlvUIGroups.Anchor = 'Top, Bottom, Left'
	[void]$UGDlvUIGroups.Columns.Add($Name)
	[void]$UGDlvUIGroups.Columns.Add($Type)
	[void]$UGDlvUIGroups.Columns.Add($Description)
	$UGDlvUIGroups.Location = '12, 12'
	$UGDlvUIGroups.Name = "UGDlvUIGroups"
	$UGDlvUIGroups.Size = '716, 407'
	$UGDlvUIGroups.TabIndex = 1
	$UGDlvUIGroups.UseCompatibleStateImageBehavior = $False
	$UGDlvUIGroups.View = 'Details'
	#
	# buttonOK
	#
	$buttonOK.Anchor = 'Bottom, Right'
	$buttonOK.DialogResult = 'OK'
	$buttonOK.Location = '653, 425'
	$buttonOK.Name = "buttonOK"
	$buttonOK.Size = '75, 23'
	$buttonOK.TabIndex = 0
	$buttonOK.Text = "OK"
	$buttonOK.UseVisualStyleBackColor = $True
	#
	# Name
	#
	$Name.Text = "Name"
	$Name.Width = 193
	#
	# Description
	#
	$Description.Text = "Description"
	$Description.Width = 413
	#
	# Type
	#
	$Type.Text = "Type"
	$Type.Width = 97
	#endregion Generated Form Code

	#----------------------------------------------

	#Save the initial state of the form
	$InitialFormWindowState = $formUGD.WindowState
	#Init the OnLoad event to correct the initial state of the form
	$formUGD.add_Load($Form_StateCorrection_Load)
	#Clean up the control events
	$formUGD.add_FormClosed($Form_Cleanup_FormClosed)
	#Store the control values when form is closing
	$formUGD.add_Closing($Form_StoreValues_Closing)
	#Show the Form
	return $formUGD.ShowDialog()

}
#endregion Source: UserGroupDetails.pff

#region Source: UAMessagingAddresses.pff
function Call-UAMessagingAddresses_pff
{
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
JBwAAB+LCAAAAAAABADVWVtv4jgUfl9p/0OUZ5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YlJMf1wGGKX4ab9JPTzv7vsWH6jllwiWTR2CSndmRE6szFpcGM/
kcQfRk24Jw6SgI1fadWRhwAPALhthlG0GUZjvjCu2h1iGZ0WGAiVTaTdyLZrcsHo/AQt/yDKmRb5
cMRrQd5wMY+JVTcW7UV30WhY7ToxyMFYl6mHSHKRQP/a7DIFUYEbhAt/BuKVmnAULMouFVKQgIuU
F1WFrIClnaG2zWPMKv0pUjeSiIgz+gscQMcJ4g8VNncd0dkrTxoJb83o0iOlmpYiddEFuHIiIGAt
NWdmZBvtiecivcXvE773vZgyIhfIGsM/FMfGD9urC8+ZPY3UzBJ92hryNxCzJTAW396oQSsjjL/W
0t3qz8D0BEWi31yApA0yN0XBqmZvi+JvDcszZUZ5R76rv7tQedJrcE1B1+km13KlwbHT8ZM935VM
+NoX6mSVUsrIbtWlhkPYToL54txrtugosfcVZmZv57soVzs58aWu5GoJ7CMSkreC/wN4ttG+JBwA
AA==#>
#endregion
Param([string[]]$Addresses)

	#----------------------------------------------
	#region Import the Assemblies
	#----------------------------------------------
	[void][reflection.assembly]::Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	#endregion Import Assemblies

	#----------------------------------------------
	#region Generated Form Objects
	#----------------------------------------------
	[System.Windows.Forms.Application]::EnableVisualStyles()
	$FormUAMA = New-Object 'System.Windows.Forms.Form'
	$UAMAbtnCancel = New-Object 'System.Windows.Forms.Button'
	$UAMAbtnMakePrimary = New-Object 'System.Windows.Forms.Button'
	$UAMAbtnReset = New-Object 'System.Windows.Forms.Button'
	$UAMAbtnRemove = New-Object 'System.Windows.Forms.Button'
	$UAMAbtnAdd = New-Object 'System.Windows.Forms.Button'
	$UAMAlvAddresses = New-Object 'System.Windows.Forms.ListView'
	$UAMAbtnOk = New-Object 'System.Windows.Forms.Button'
	$MessagingAddresses = New-Object 'System.Windows.Forms.ColumnHeader'
	$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
	#endregion Generated Form Objects

	#----------------------------------------------
	# User Generated Script
	#----------------------------------------------
	
	
	$FormEvent_Load={
		#TODO: Initialize Form Controls here
	}
	
	#region Control Helper Functions
	function Sort-ListViewColumn 
	{
		<#
		.SYNOPSIS
			Sort the ListView's item using the specified column.
	
		.DESCRIPTION
			Sort the ListView's item using the specified column.
			This function uses Add-Type to define a class that sort the items.
			The ListView's Tag property is used to keep track of the sorting.
	
		.PARAMETER ListView
			The ListView control to sort.
	
		.PARAMETER ColumnIndex
			The index of the column to use for sorting.
			
		.PARAMETER  SortOrder
			The direction to sort the items. If not specified or set to None, it will toggle.
		
		.EXAMPLE
			Sort-ListViewColumn -ListView $listview1 -ColumnIndex 0
	#>
		param(	
				[ValidateNotNull()]
				[Parameter(Mandatory=$true)]
				[System.Windows.Forms.ListView]$ListView,
				[Parameter(Mandatory=$true)]
				[int]$ColumnIndex,
				[System.Windows.Forms.SortOrder]$SortOrder = 'None')
		
		if(($ListView.Items.Count -eq 0) -or ($ColumnIndex -lt 0) -or ($ColumnIndex -ge $ListView.Columns.Count))
		{
			return;
		}
		
		#region Define ListViewItemComparer
			try{
			$local:type = [ListViewItemComparer]
		}
		catch{
		Add-Type -ReferencedAssemblies ('System.Windows.Forms') -TypeDefinition  @" 
using System;
using System.Windows.Forms;
using System.Collections;
public class ListViewItemComparer : IComparer
{
    public int column;
    public SortOrder sortOrder;
    public ListViewItemComparer()
    {
        column = 0;
		sortOrder = SortOrder.Ascending;
    }
    public ListViewItemComparer(int column, SortOrder sort)
    {
        this.column = column;
		sortOrder = sort;
    }
    public int Compare(object x, object y)
    {
		if(column >= ((ListViewItem)x).SubItems.Count)
			return  sortOrder == SortOrder.Ascending ? -1 : 1;
	
		if(column >= ((ListViewItem)y).SubItems.Count)
			return sortOrder == SortOrder.Ascending ? 1 : -1;
	
		if(sortOrder == SortOrder.Ascending)
        	return String.Compare(((ListViewItem)x).SubItems[column].Text, ((ListViewItem)y).SubItems[column].Text);
		else
			return String.Compare(((ListViewItem)y).SubItems[column].Text, ((ListViewItem)x).SubItems[column].Text);
    }
}
"@  | Out-Null
		}
		#endregion
		
		if($ListView.Tag -is [ListViewItemComparer])
		{
			#Toggle the Sort Order
			if($SortOrder -eq [System.Windows.Forms.SortOrder]::None)
			{
				if($ListView.Tag.column -eq $ColumnIndex -and $ListView.Tag.sortOrder -eq 'Ascending')
				{
					$ListView.Tag.sortOrder = 'Descending'
				}
				else
				{
					$ListView.Tag.sortOrder = 'Ascending'
				}
			}
			else
			{
				$ListView.Tag.sortOrder = $SortOrder
			}
			
			$ListView.Tag.column = $ColumnIndex
			$ListView.Sort()#Sort the items
		}
		else
		{
			if($Sort -eq [System.Windows.Forms.SortOrder]::None)
			{
				$Sort = [System.Windows.Forms.SortOrder]::Ascending	
			}
			
			#Set to Tag because for some reason in PowerShell ListViewItemSorter prop returns null
			$ListView.Tag = New-Object ListViewItemComparer ($ColumnIndex, $SortOrder) 
			$ListView.ListViewItemSorter = $ListView.Tag #Automatically sorts
		}
	}
	
	
	function Add-ListViewItem
	{
	<#
		.SYNOPSIS
			Adds the item(s) to the ListView and stores the object in the ListViewItem's Tag property.
	
		.DESCRIPTION
			Adds the item(s) to the ListView and stores the object in the ListViewItem's Tag property.
	
		.PARAMETER ListView
			The ListView control to add the items to.
	
		.PARAMETER Items
			The object or objects you wish to load into the ListView's Items collection.
			
		.PARAMETER  ImageIndex
			The index of a predefined image in the ListView's ImageList.
		
		.PARAMETER  SubItems
			List of strings to add as Subitems.
		
		.PARAMETER Group
			The group to place the item(s) in.
		
		.PARAMETER Clear
			This switch clears the ListView's Items before adding the new item(s).
		
		.EXAMPLE
			Add-ListViewItem -ListView $listview1 -Items "Test" -Group $listview1.Groups[0] -ImageIndex 0 -SubItems "Installed"
	#>
		
		Param( 
		[ValidateNotNull()]
		[Parameter(Mandatory=$true)]
		[System.Windows.Forms.ListView]$ListView,
		[ValidateNotNull()]
		[Parameter(Mandatory=$true)]
		$Items,
		[int]$ImageIndex = -1,
		[string[]]$SubItems,
		[System.Windows.Forms.ListViewGroup]$Group,
		[switch]$Clear)
		
		if($Clear)
		{
			$ListView.Items.Clear();
		}
		
		if($Items -is [Array])
		{
			$ListView.BeginUpdate()
			foreach ($item in $Items)
			{		
				$listitem  = $ListView.Items.Add($item.ToString(), $ImageIndex)
				#Store the object in the Tag
				$listitem.Tag = $item
				
				if($SubItems -ne $null)
				{
					$listitem.SubItems.AddRange($SubItems)
				}
				
				if($Group -ne $null)
				{
					$listitem.Group = $Group
				}
			}
			$ListView.EndUpdate()
		}
		else
		{
			#Add a new item to the ListView
			$listitem  = $ListView.Items.Add($Items.ToString(), $ImageIndex)
			#Store the object in the Tag
			$listitem.Tag = $Items
			
			if($SubItems -ne $null)
			{
				$listitem.SubItems.AddRange($SubItems)
			}
			
			if($Group -ne $null)
			{
				$listitem.Group = $Group
			}
		}
	}
	
	#endregion
	#Write-Host $Addresses
	foreach($a in $Addresses){
		Add-ListViewItem -ListView $UAMAlvAddresses -Items $a
	}
	$UAMAbtnAdd_Click={
		#TODO: Place custom script here
		if((Call-UAAddAddress_pff) -eq "OK"){
			if($UAAddAddress_checkboxMakeAddressPrimary	-eq $true){
				Write-Host "True"
			}
			
			Add-ListViewItem $UAAddAddress_textbox1
		}
	}
	
	$UAMAbtnRemove_Click={
		#TODO: Place custom script here
		
	}
	
	$UAMAbtnReset_Click={
		#TODO: Place custom script here
		
	}
	
	$UAMAbtnMakePrimary_Click={
		#TODO: Place custom script here
		
	}
	
	
	
	# --End User Generated Script--
	#----------------------------------------------
	#region Generated Events
	#----------------------------------------------
	
	$Form_StateCorrection_Load=
	{
		#Correct the initial state of the form to prevent the .Net maximized form issue
		$FormUAMA.WindowState = $InitialFormWindowState
	}
	
	$Form_StoreValues_Closing=
	{
		#Store the control values
		$script:UAMessagingAddresses_UAMAlvAddresses = $UAMAlvAddresses.SelectedItems
	}

	
	$Form_Cleanup_FormClosed=
	{
		#Remove all event handlers from the controls
		try
		{
			$UAMAbtnMakePrimary.remove_Click($UAMAbtnMakePrimary_Click)
			$UAMAbtnReset.remove_Click($UAMAbtnReset_Click)
			$UAMAbtnRemove.remove_Click($UAMAbtnRemove_Click)
			$UAMAbtnAdd.remove_Click($UAMAbtnAdd_Click)
			$FormUAMA.remove_Load($FormEvent_Load)
			$FormUAMA.remove_Load($Form_StateCorrection_Load)
			$FormUAMA.remove_Closing($Form_StoreValues_Closing)
			$FormUAMA.remove_FormClosed($Form_Cleanup_FormClosed)
		}
		catch [Exception]
		{ }
	}
	#endregion Generated Events

	#----------------------------------------------
	#region Generated Form Code
	#----------------------------------------------
	#
	# FormUAMA
	#
	$FormUAMA.Controls.Add($UAMAbtnCancel)
	$FormUAMA.Controls.Add($UAMAbtnMakePrimary)
	$FormUAMA.Controls.Add($UAMAbtnReset)
	$FormUAMA.Controls.Add($UAMAbtnRemove)
	$FormUAMA.Controls.Add($UAMAbtnAdd)
	$FormUAMA.Controls.Add($UAMAlvAddresses)
	$FormUAMA.Controls.Add($UAMAbtnOk)
	$FormUAMA.AcceptButton = $UAMAbtnOk
	$FormUAMA.ClientSize = '360, 324'
	$FormUAMA.FormBorderStyle = 'FixedDialog'
	$FormUAMA.MaximizeBox = $False
	$FormUAMA.MinimizeBox = $False
	$FormUAMA.Name = "FormUAMA"
	$FormUAMA.StartPosition = 'CenterScreen'
	$FormUAMA.Text = "Messaging Addresses"
	$FormUAMA.add_Load($FormEvent_Load)
	#
	# UAMAbtnCancel
	#
	$UAMAbtnCancel.DialogResult = 'Cancel'
	$UAMAbtnCancel.Location = '192, 289'
	$UAMAbtnCancel.Name = "UAMAbtnCancel"
	$UAMAbtnCancel.Size = '75, 23'
	$UAMAbtnCancel.TabIndex = 4
	$UAMAbtnCancel.Text = "Cancel"
	$UAMAbtnCancel.UseVisualStyleBackColor = $True
	#
	# UAMAbtnMakePrimary
	#
	$UAMAbtnMakePrimary.Location = '258, 12'
	$UAMAbtnMakePrimary.Name = "UAMAbtnMakePrimary"
	$UAMAbtnMakePrimary.Size = '90, 23'
	$UAMAbtnMakePrimary.TabIndex = 3
	$UAMAbtnMakePrimary.Text = "Make Primary"
	$UAMAbtnMakePrimary.UseVisualStyleBackColor = $True
	$UAMAbtnMakePrimary.add_Click($UAMAbtnMakePrimary_Click)
	#
	# UAMAbtnReset
	#
	$UAMAbtnReset.Location = '176, 12'
	$UAMAbtnReset.Name = "UAMAbtnReset"
	$UAMAbtnReset.Size = '75, 23'
	$UAMAbtnReset.TabIndex = 2
	$UAMAbtnReset.Text = "Reset"
	$UAMAbtnReset.UseVisualStyleBackColor = $True
	$UAMAbtnReset.add_Click($UAMAbtnReset_Click)
	#
	# UAMAbtnRemove
	#
	$UAMAbtnRemove.Location = '94, 12'
	$UAMAbtnRemove.Name = "UAMAbtnRemove"
	$UAMAbtnRemove.Size = '75, 23'
	$UAMAbtnRemove.TabIndex = 1
	$UAMAbtnRemove.Text = "Remove"
	$UAMAbtnRemove.UseVisualStyleBackColor = $True
	$UAMAbtnRemove.add_Click($UAMAbtnRemove_Click)
	#
	# UAMAbtnAdd
	#
	$UAMAbtnAdd.Location = '13, 12'
	$UAMAbtnAdd.Name = "UAMAbtnAdd"
	$UAMAbtnAdd.Size = '75, 23'
	$UAMAbtnAdd.TabIndex = 0
	$UAMAbtnAdd.Text = "Add"
	$UAMAbtnAdd.UseVisualStyleBackColor = $True
	$UAMAbtnAdd.add_Click($UAMAbtnAdd_Click)
	#
	# UAMAlvAddresses
	#
	[void]$UAMAlvAddresses.Columns.Add($MessagingAddresses)
	$UAMAlvAddresses.Location = '13, 41'
	$UAMAlvAddresses.Name = "UAMAlvAddresses"
	$UAMAlvAddresses.Size = '335, 237'
	$UAMAlvAddresses.TabIndex = 6
	$UAMAlvAddresses.UseCompatibleStateImageBehavior = $False
	$UAMAlvAddresses.View = 'Details'
	#
	# UAMAbtnOk
	#
	$UAMAbtnOk.Anchor = 'Bottom, Right'
	$UAMAbtnOk.DialogResult = 'OK'
	$UAMAbtnOk.Location = '273, 289'
	$UAMAbtnOk.Name = "UAMAbtnOk"
	$UAMAbtnOk.Size = '75, 23'
	$UAMAbtnOk.TabIndex = 5
	$UAMAbtnOk.Text = "OK"
	$UAMAbtnOk.UseVisualStyleBackColor = $True
	#
	# MessagingAddresses
	#
	$MessagingAddresses.Text = "Messaging Addresses"
	$MessagingAddresses.Width = 311
	#endregion Generated Form Code

	#----------------------------------------------

	#Save the initial state of the form
	$InitialFormWindowState = $FormUAMA.WindowState
	#Init the OnLoad event to correct the initial state of the form
	$FormUAMA.add_Load($Form_StateCorrection_Load)
	#Clean up the control events
	$FormUAMA.add_FormClosed($Form_Cleanup_FormClosed)
	#Store the control values when form is closing
	$FormUAMA.add_Closing($Form_StoreValues_Closing)
	#Show the Form
	return $FormUAMA.ShowDialog()

}
#endregion Source: UAMessagingAddresses.pff

#region Source: UAAddAddress.pff
function Call-UAAddAddress_pff
{
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
/BUAAB+LCAAAAAAABADVWFtv6kYQfq/U/2D5mWKMIZAKLIFzUkVJGhQ4p32r1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VeiNsUNhEZBnRb8ABF95ob7nC
apaVd6290kJ4FxRDrS3VbSm2LjqDSHkSsq7l2j2rIltpe3GE7a18vrH2ew9GjKh0rOL+guuubtYj
qZiPJ4P046i4WhuKN5DjF2CsnM6ln9AVYdm8t7PVG0MQS4qvgtVka9ugMgnMUK1OA8v3yjQOVEV5
R76rvwvUPukNRIGki+0kW3ulnggXhCebOd+VeGKRyPT0sKVUkd2lUypO2E6A+8V7x6jFC/PdRxhZ
uB5MFbFuSHrW1sjV2uA+MmFz2vsvQfKAAvwVAAA=#>
#endregion
	#----------------------------------------------
	#region Import the Assemblies
	#----------------------------------------------
	[void][reflection.assembly]::Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	#endregion Import Assemblies

	#----------------------------------------------
	#region Generated Form Objects
	#----------------------------------------------
	[System.Windows.Forms.Application]::EnableVisualStyles()
	$formUAAddAddress = New-Object 'System.Windows.Forms.Form'
	$buttonCancel = New-Object 'System.Windows.Forms.Button'
	$txtbxEmailAddress = New-Object 'System.Windows.Forms.TextBox'
	$labelEmailAddress = New-Object 'System.Windows.Forms.Label'
	$labelSMTP = New-Object 'System.Windows.Forms.Label'
	$UAAAlblAddressType = New-Object 'System.Windows.Forms.Label'
	$buttonOK = New-Object 'System.Windows.Forms.Button'
	$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
	#endregion Generated Form Objects

	#----------------------------------------------
	# User Generated Script
	#----------------------------------------------
	
	$FormEvent_Load={
		#TODO: Initialize Form Controls here
		
	}
	
		# --End User Generated Script--
	#----------------------------------------------
	#region Generated Events
	#----------------------------------------------
	
	$Form_StateCorrection_Load=
	{
		#Correct the initial state of the form to prevent the .Net maximized form issue
		$formUAAddAddress.WindowState = $InitialFormWindowState
	}
	
	$Form_StoreValues_Closing=
	{
		#Store the control values
		$script:UAAddAddress_txtbxEmailAddress = $txtbxEmailAddress.Text
	}

	
	$Form_Cleanup_FormClosed=
	{
		#Remove all event handlers from the controls
		try
		{
			$formUAAddAddress.remove_Load($FormEvent_Load)
			$formUAAddAddress.remove_Load($Form_StateCorrection_Load)
			$formUAAddAddress.remove_Closing($Form_StoreValues_Closing)
			$formUAAddAddress.remove_FormClosed($Form_Cleanup_FormClosed)
		}
		catch [Exception]
		{ }
	}
	#endregion Generated Events

	#----------------------------------------------
	#region Generated Form Code
	#----------------------------------------------
	#
	# formUAAddAddress
	#
	$formUAAddAddress.Controls.Add($buttonCancel)
	$formUAAddAddress.Controls.Add($txtbxEmailAddress)
	$formUAAddAddress.Controls.Add($labelEmailAddress)
	$formUAAddAddress.Controls.Add($labelSMTP)
	$formUAAddAddress.Controls.Add($UAAAlblAddressType)
	$formUAAddAddress.Controls.Add($buttonOK)
	$formUAAddAddress.AcceptButton = $buttonOK
	$formUAAddAddress.ClientSize = '284, 109'
	$formUAAddAddress.FormBorderStyle = 'FixedDialog'
	$formUAAddAddress.MaximizeBox = $False
	$formUAAddAddress.MinimizeBox = $False
	$formUAAddAddress.Name = "formUAAddAddress"
	$formUAAddAddress.StartPosition = 'CenterScreen'
	$formUAAddAddress.Text = "Add Address"
	$formUAAddAddress.add_Load($FormEvent_Load)
	#
	# buttonCancel
	#
	$buttonCancel.DialogResult = 'Cancel'
	$buttonCancel.Location = '116, 74'
	$buttonCancel.Name = "buttonCancel"
	$buttonCancel.Size = '75, 23'
	$buttonCancel.TabIndex = 2
	$buttonCancel.Text = "Cancel"
	$buttonCancel.UseVisualStyleBackColor = $True
	#
	# txtbxEmailAddress
	#
	$txtbxEmailAddress.Location = '88, 40'
	$txtbxEmailAddress.Name = "txtbxEmailAddress"
	$txtbxEmailAddress.Size = '184, 20'
	$txtbxEmailAddress.TabIndex = 0
	#
	# labelEmailAddress
	#
	$labelEmailAddress.Location = '13, 43'
	$labelEmailAddress.Name = "labelEmailAddress"
	$labelEmailAddress.Size = '84, 23'
	$labelEmailAddress.TabIndex = 6
	$labelEmailAddress.Text = "Email Address:"
	#
	# labelSMTP
	#
	$labelSMTP.Location = '85, 13'
	$labelSMTP.Name = "labelSMTP"
	$labelSMTP.Size = '43, 23'
	$labelSMTP.TabIndex = 5
	$labelSMTP.Text = "SMTP"
	#
	# UAAAlblAddressType
	#
	$UAAAlblAddressType.Location = '13, 13'
	$UAAAlblAddressType.Name = "UAAAlblAddressType"
	$UAAAlblAddressType.Size = '84, 23'
	$UAAAlblAddressType.TabIndex = 4
	$UAAAlblAddressType.Text = "Address Type:"
	#
	# buttonOK
	#
	$buttonOK.Anchor = 'Bottom, Right'
	$buttonOK.DialogResult = 'OK'
	$buttonOK.Location = '197, 74'
	$buttonOK.Name = "buttonOK"
	$buttonOK.Size = '75, 23'
	$buttonOK.TabIndex = 3
	$buttonOK.Text = "OK"
	$buttonOK.UseVisualStyleBackColor = $True
	#endregion Generated Form Code

	#----------------------------------------------

	#Save the initial state of the form
	$InitialFormWindowState = $formUAAddAddress.WindowState
	#Init the OnLoad event to correct the initial state of the form
	$formUAAddAddress.add_Load($Form_StateCorrection_Load)
	#Clean up the control events
	$formUAAddAddress.add_FormClosed($Form_Cleanup_FormClosed)
	#Store the control values when form is closing
	$formUAAddAddress.add_Closing($Form_StoreValues_Closing)
	#Show the Form
	return $formUAAddAddress.ShowDialog()

}
#endregion Source: UAAddAddress.pff

#region Source: OUPicker.pff
function Call-OUPicker_pff
{
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
Wg4AAB+LCAAAAAAABAC9V21P2zAQ/j5p/yHK565pSENBSiO1YUyIMSpa2L5NrnMpHo5dOQ4l+/W7
pEnfUmhAA1Wq4vNz7+fz2bsBKh9BZWdEE//zJ8PwrhWbMUH4OePwg8TgX9+OGH0A1Z5HkWfVtgum
fHUHKmFS+Hb7yLM2CUux0z9AtaGzOfTNcZZoiNs/mQjlImmfSxUv/1vGvq2WUYrqd9ud/NcygpTr
VEFfQKoV4S1jlE45o5eQTeQDiP601yMudY/tU6cLnZNT0xBobN+MUJ5tGvSe8VAhzgyk0EryxCzM
RENHSs5B6axkGFAKcz1MtZaiwiDqBiJAfgolbFoAri9Nw6oEWZWkZyQHnIHQY/YXTL97etIyXNc+
yJTHYyhVCGqsM46c5+wJwjNGuJwdZL4iTyxGfUP5hIyEJ3CYhYnXsuRVYfpFoA9ix5ooPZIJ0ywP
b4ABQc+oAhAHeSfwpNEm1FOHfn1ESSXuuyThEldQf+drzyq+K/jh4pygSXcMFu9eoJO7l6qzHoXv
kpJl8GynZdhOLRbPJWhy1wBaVmfvqGV0T3sNGCZkeiFCwGLZk3xrGefmUV8eu3eP+frwvibyA0Hv
pTL9oURu7Fw3bHavG4RoeVhvIEFrTf/6sgHLOsld28ZGYR83TnPlW+Nk99yWcdSkjNap7jRBF6e1
kR23CR61JCW8aHFDQh8CyfNIT1S6p/1sVtX2YpAkEGMFQFJhS0rmlxV1RQSZQYytoD1IMYtFlNeV
5TStLMeeRs6Je0xC57gLjutZK027muOESsXZ9D/U7wta3unEHNZ4psiCidlbdHWcyI16kW2Hboc4
5KCuj/EHB6MPUfQr5h/jEFN4QKTKxqAeGYU3lcVrU9UOpIIPca/0CpsEuvYOvq2WVVfxRtigsImo
yqJvIAAFb7S3JWA1LZfT4T5qSbyg5di8Bd2mYutiESQ6UFB0rfzCrdFW6CBNsL1V+xuyn9sYcaLz
Gc7/kl/k1WI9/6ZiPBnknb/8WjPKBY5w98B5Nf/jc6BOrJr3drS8MdBUMbwKVmP0NkPtrVFktf7e
qO6VMKW6Bt6h7+J3E7WPegYJVWy+HWRrLzWQ8ZyIbDPmu5RAzjOVjw9boBrtIp+O8e21Y+B+8t6H
WnlhPruFlsXrubi0dYPiWVuPOmuj9rESNt+S/wAXot9LWg4AAA==#>
#endregion
	#----------------------------------------------
	#region Import the Assemblies
	#----------------------------------------------
	[void][reflection.assembly]::Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	#endregion Import Assemblies

	#----------------------------------------------
	#region Generated Form Objects
	#----------------------------------------------
	[System.Windows.Forms.Application]::EnableVisualStyles()
	$form1 = New-Object 'System.Windows.Forms.Form'
	$TV = New-Object 'System.Windows.Forms.TreeView'
	$buttonOK = New-Object 'System.Windows.Forms.Button'
	$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
	#endregion Generated Form Objects

	#----------------------------------------------
	# User Generated Script
	#----------------------------------------------
	
	Import-Module ActiveDirectory
	
	$FormEvent_Load={
		#TODO: Initialize Form Controls here
		
	}
	Function Browse-ActiveDirectory { 
	  param ([directoryservices.directoryEntry]$root = (new-object system.directoryservices.directoryEntry))
	
	  # Try to connect to the Domain root 
	  &{trap {throw "$($_)"};[void]$Root.get_Name()} 
	
	  # Create a TreeNode for the domain root found 
	  $TNRoot = new-object System.Windows.Forms.TreeNode("Root") 
	  $TNRoot.Name = $root.name 
	  $TNRoot.Text = $root.distinguishedName 
	  $TNRoot.tag = "NotEnumerated" 
	
	  # First time a Node is Selected, enumerate the Children of the selected DirectoryEntry 
	  $TV.add_AfterSelect({ 
	    if ($this.SelectedNode.tag -eq "NotEnumerated") { 
	
	      #$de = new-object system.directoryservices.directoryEntry("LDAP://$($this.SelectedNode.text)") 
			Get-ADObject -Filter {ObjectClass -eq "organizationalUnit"} -SearchBase $this.SelectedNode.text -SearchScope 1 |
	      # Add all Children found as Sub Nodes to the selected TreeNode 
	      #$de.get_Children() |  
	      foreach {
					Write-Host $_.distinguishedName
			if ($_.distinguishedName -match '^CN.*$'){return}
	        $TN = new-object System.Windows.Forms.TreeNode 
	        $TN.Name = $_.name 
	        $TN.Text = $_.distinguishedName 
	        $TN.tag = "NotEnumerated" 
	        $this.SelectedNode.Nodes.Add($TN) 
	      } 
	
	      # Set tag to show this node is already enumerated 
	       $this.SelectedNode.tag = "Enumerated" 
	    } 
	  }) 
	
	  # Add the RootNode to the Treeview 
	  [void]$TV.Nodes.Add($TNRoot) 
	
	  Return $script:Return 
	} 
	#function Add-Node {
	## Copied from http://blogs.technet.com/b/heyscriptingguy/archive/2010/06/15/hey-scripting-guy-how-can-i-use-the-windows-forms-treeview-control.aspx
	#	param (
	#	$selectedNode,
	#	$name,
	#	$tag
	#	)
	#	$newNode = new-object System.Windows.Forms.TreeNode
	#	$newNode.Name = $name
	#	$newNode.Text = $name
	#	$newNode.Tag = $tag
	#	$selectedNode.Nodes.Add($newNode) | Out-Null
	#	return $newNode
	#}
	
		# --End User Generated Script--
	#----------------------------------------------
	#region Generated Events
	#----------------------------------------------
	
	$Form_StateCorrection_Load=
	{
		#Correct the initial state of the form to prevent the .Net maximized form issue
		$form1.WindowState = $InitialFormWindowState
	}
	
	$Form_StoreValues_Closing=
	{
		#Store the control values
		if($TV.SelectedNode -ne $null)
		{
			$script:OUPicker_TV = $TV.SelectedNode.Text
		}
		else
		{
			$script:OUPicker_TV = $null
		}
	}

	
	$Form_Cleanup_FormClosed=
	{
		#Remove all event handlers from the controls
		try
		{
			$form1.remove_Load($FormEvent_Load)
			$form1.remove_Load($Form_StateCorrection_Load)
			$form1.remove_Closing($Form_StoreValues_Closing)
			$form1.remove_FormClosed($Form_Cleanup_FormClosed)
		}
		catch [Exception]
		{ }
	}
	#endregion Generated Events

	#----------------------------------------------
	#region Generated Form Code
	#----------------------------------------------
	#
	# form1
	#
	$form1.Controls.Add($TV)
	$form1.Controls.Add($buttonOK)
	$form1.AcceptButton = $buttonOK
	$form1.ClientSize = '498, 551'
	$form1.FormBorderStyle = 'FixedDialog'
	$form1.MaximizeBox = $False
	$form1.MinimizeBox = $False
	$form1.Name = "form1"
	$form1.StartPosition = 'CenterScreen'
	$form1.Text = "Form"
	$form1.add_Load($FormEvent_Load)
	#
	# TV
	#
	$TV.Location = '13, 13'
	$TV.Name = "TV"
	$TV.Size = '472, 497'
	$TV.TabIndex = 1
	#
	# buttonOK
	#
	$buttonOK.Anchor = 'Bottom, Right'
	$buttonOK.DialogResult = 'OK'
	$buttonOK.Location = '411, 516'
	$buttonOK.Name = "buttonOK"
	$buttonOK.Size = '75, 23'
	$buttonOK.TabIndex = 0
	$buttonOK.Text = "OK"
	$buttonOK.UseVisualStyleBackColor = $True
	#endregion Generated Form Code

	#----------------------------------------------

	#Save the initial state of the form
	$InitialFormWindowState = $form1.WindowState
	#Init the OnLoad event to correct the initial state of the form
	$form1.add_Load($Form_StateCorrection_Load)
	#Clean up the control events
	$form1.add_FormClosed($Form_Cleanup_FormClosed)
	#Store the control values when form is closing
	$form1.add_Closing($Form_StoreValues_Closing)
	#Show the Form
	return $form1.ShowDialog()

}
#endregion Source: OUPicker.pff

#Start the application
Main ($CommandLine)
